OGeek|极客世界-中国程序员成长平台

标题: iphone - 在 UIWebView 中使用进度条? [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-13 09:02
标题: iphone - 在 UIWebView 中使用进度条?

是否可以在加载网页时使用带有 UIWebView 的进度条,就像 Safari 在地址栏中所做的那样?我读到您需要使用 Apple 不允许的私有(private) API,但这似乎不对……您无法检测页面的大小并根据下载量更新进度条?



Best Answer-推荐答案


对于这种事情,您只能通过使用 Content-Length header 来真正“检测”页面大小,但除此之外您仍然可以呈现加载控件(如移动斑马线类型之一不显示离散百分比进度但显示事件正在发生的条形图.. 甚至只是一个 UIActivityIndi​​cator)。您可以尝试像 ASIWebPageRequest 这样的现成类(class)也可以显示进度。作者表示:

ASIWebPageRequests do not currently support progress tracking for an entire request with its external resources. However, progress updates from external resource requests are passed on to your delegate, so with a bit of work it may be possible to implement this yourself.

关于iphone - 在 UIWebView 中使用进度条?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7225421/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://sqlite.in/) Powered by Discuz! X3.4