UIWebView webViewDidLoadFinish method not called

后端 未结 6 941
南笙
南笙 2021-02-05 22:50

I\'ve been playing around with web views in swift this evening, but have run into a bit of an issue.

For some reason I\'m not able to get the webViewDidStartLoad or webV

6条回答
  •  借酒劲吻你
    2021-02-05 23:21

    Here's my 2 cents battling with the same problem in SWIFT 3:

    class HintViewController: UIViewController, UIWebViewDelegate
    

    Declare the delegate methods this way (note the declaration of the arguments):

    func webViewDidStartLoad(_ webView: UIWebView)
    func webViewDidFinishLoad(_ webView: UIWebView)
    

    Remember to set self to the webview's delegate property either in Interface Builder (Select the webview, drag from the delegate outlet to the webview from the Connections Inspector OR programmatically: self.webview.delegate = self)

提交回复
热议问题