Load local html into UIWebView using swift

前端 未结 13 2077
耶瑟儿~
耶瑟儿~ 2020-11-28 22:27

This one is driving me crazy early this morning. I want to load some local html into a web view:

class PrivacyController: UIViewController {

    @IBOutlet w         


        
13条回答
  •  日久生厌
    2020-11-28 23:12

    Swift 3 with 3 lines :)

    if let url = Bundle.main.url(forResource: "privacy", withExtension: "html") {
        webview.loadRequest(URLRequest(url: url))
    }
    

提交回复
热议问题