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 消息?
基础教程推荐
- AdMob 广告未在模拟器中显示 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
