Detect when WKWebView has finished loading EVERY time

后端 未结 1 487
不知归路
不知归路 2020-12-15 07:14

I have a WKWebView app running on iOS8 on iPad (standard iPad UserAgent : \"Mozilla/5.0 (iPad; CPU OS 8_1_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.

相关标签:
1条回答
  • 2020-12-15 07:49

    I'm not sure what exactly you want to do when page have loaded, but hopefully observing these properties can help you:

    webView.addObserver(self, forKeyPath: "estimatedProgress", options: .New, context: nil)
    webView.addObserver(self, forKeyPath: "loading", options: .New, context: nil)
    webView.addObserver(self, forKeyPath: "title", options: .New, context: nil)
    webView.addObserver(self, forKeyPath: "canGoBack", options: .New, context: nil)
    webView.addObserver(self, forKeyPath: "canGoForward", options: .New, context: nil)
    
    0 讨论(0)
提交回复
热议问题