菜鸟教程小白 发表于 2022-12-13 09:02:50

iphone - 在 UIWebView 中使用进度条?


                                            <p><p>是否可以在加载网页时使用带有 UIWebView 的进度条,就像 Safari 在地址栏中所做的那样?我读到您需要使用 Apple 不允许的私有(private) API,但这似乎不对……您无法检测页面的大小并根据下载量更新进度条?</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>对于这种事情,您只能通过使用 <code>Content-Length</code>header 来真正“检测”页面大小,但除此之外您仍然可以呈现加载控件(如移动斑马线类型之一不显示离散百分比进度但显示事件正在发生的条形图.. 甚至只是一个 <code>UIActivityIndi​​cator</code>)。您可以尝试像 <a href="http://allseeing-i.com/ASIHTTPRequest/ASIWebPageRequest" rel="noreferrer noopener nofollow"><code>ASIWebPageRequest</code></a> 这样的现成类(class)也可以显示进度。作者表示:</p>

<blockquote>
<p>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.</p>
</blockquote></p>
                                   
                                                <p style="font-size: 20px;">关于iphone - 在 UIWebView 中使用进度条?,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/7225421/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/7225421/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: iphone - 在 UIWebView 中使用进度条?