参考http://blog.csdn.net/zhaoweixing1989/article/details/13021513
(1)获取加载页面的URL地址,加载开始,加载完成,加载失败的监听
</pre><p><span style="font-size:18px">让当前的ViewController实现</span>UIWebViewDelegate代理然后实现代理中的方法:</p><pre code_snippet_id="1895631" snippet_file_name="blog_20160923_2_6890158" name="code" class="html">//使用UIWebView代理方法 func webView(webView: UIWebView,shouldStartLoadWithRequest request: NSURLRequest,navigationType: UIWebViewNavigationType) -> Bool { print(request.URL) if request.URL!.absoluteString.hasPrefix("app://") { //解析app://report?userId=0001逻辑 return false } return true } func webViewDidStartLoad(webView: UIWebView) { //开始加载 //activityLoadingView.startAnimating() // print(self.artworkWebView.request?.URL?.absoluteString) } func webView(webView: UIWebView,didFailLoadWithError error: NSError?) { //加载失败 } func webViewDidFinishLoad(webView: UIWebView) { //加载成功,加载完成 // activityLoadingView.stopAnimating() }原文链接:https://www.f2er.com/swift/322990.html