UIWebView webViewDidLoadFinish method not called

后端 未结 6 942
南笙
南笙 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:20

    There is my detailed solution for Swift 3:

    1) in class declaration write the UIWebViewDelegate. For example:

    class MyViewController: UIViewController, UIWebViewDelegate {

    2) of course in storyboard make link to your UIViewController like this: @IBOutlet weak var webView: UIWebView!

    3) in the func viewDidLoad add one line: self.webView.delegate = self

    Nothing more. Special thinks to LinusGeffarth and LLIAJLbHOu for idea.

提交回复
热议问题