UIWebView - How to identify the quot;lastquot; webViewDidFinishLoad message?(UIWebView - 如何识别“最后一个webViewDidFinishLoad 消息?)
问题描述
webViewDidFinishLoad 消息似乎是在每次页面中的 any 对象被加载时发送的.有没有办法确定所有内容的加载都已完成?
The webViewDidFinishLoad message seems to be sent each time any object in the page has been loaded. Is there a way to determine that all loading of content is done?
推荐答案
有趣,我没想到它会这样工作.虽然我确定还有其他方法可以做到这一点(有没有办法从 webViewDidFinishLoad 消息中提取 URL,以便您可以看到哪个是完成加载的主页?),但我能想到的主要是使用估计进度来检查页面的进度,并在 100% 完成加载时触发你想做的任何事情,这就是我在我的应用程序中所做的.谷歌iphone webviewestimatedprogress"并点击第一个链接查看我写的关于如何做到这一点的指南.
Interesting, I wouldn't have thought it would work like that. Although I'm sure there are other ways to do it (is there a way to extract the URL from the webViewDidFinishLoad message so that you can see which one is the main page finishing loading?), the main thing I can think of is using the estimatedProgress to check the progress of the page and fire off whatever you want to do when it's 100% finished loading, which is what I do in my app. Google "iphone webview estimatedprogress" and click the first link for a guide I wrote on how to do this.
更新:
请在下面使用 phopkins 的答案而不是我的答案!在您的应用程序中使用私有 API 是个坏主意,您可能会被拒绝,而他的解决方案是正确的.
Please use phopkins' answer below instead of mine! Using private APIs in your apps is a bad idea and you will probably get rejected, and his solution is the right one.
这篇关于UIWebView - 如何识别“最后一个"webViewDidFinishLoad 消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:UIWebView - 如何识别“最后一个"webViewDidFinishLoad 消息?
基础教程推荐
- 如何在 UIImageView 中异步加载图像? 2022-01-01
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01