可能的重复:
如何在加载 UIWebView 时使用 UIProgressView?
在我的应用程序中,我有一个 UIViewController ,其中有一个 UIWebView 和一个工具栏作为子视图。
工具栏有一个用于地址的 UITextField。加载页面时,地址字段应指示网页的加载进度,就像加载外部链接时 Safari 的地址栏或 iOS 版 Facebook 应用程序一样。
我面临的问题是,我无法找到一种方法来显示加载时页面的进度,从而使地址字段(UIText 字段)填充颜色。
有什么办法可以做到这一点或者已经为此制作了组件吗?
Possible Duplicate:
How to use UIProgressView while loading of a UIWebView?
In my app i have a UIViewController with a UIWebView and a toolbar as a subviews.
The toolbar has a UITextField for the address. When loading a page the address field should indicate the loading progress of the webpage something like Safari's address bar or Facebook app for iOS when loading an external link.
The problem that i face is that i can't find a way to show the progress of the page when loading, making the address field(UIText field) fill with a color.
Is there any way to do that or a component already made for this?
发布评论
评论(1)
据我所知,您无法读取 HTML 页面加载到 UIWebView 中的进度。不过我知道你可以做什么。它有点“即将到来”,但如果在将 HTML 页面加载到 UIWebView 时显示进度条对您来说非常重要,那么您可以执行以下操作:
[UIWebView loadHTMLString:]
将其渲染到 UIWebView 中,正如我之前提到的,这确实是非常规的,但如果您确实需要显示进度,这是我可以的唯一方法想到。
To my knowledge there is no way that you could read the progress of a HTML page being loaded into an UIWebView. However I have an idea what you could do. It is a bit "around the corner" but if displaying a progress bar while loading a HTML page into a UIWebView is REALLY important to you, here is what you could do:
[UIWebView loadHTMLString:]
As I mentioned before this is really unconventional, but if you really need the progress to be displayed it is the only way I can think of.