<small id='YKX91'></small><noframes id='YKX91'>

    1. <legend id='YKX91'><style id='YKX91'><dir id='YKX91'><q id='YKX91'></q></dir></style></legend>

      <tfoot id='YKX91'></tfoot>
      • <bdo id='YKX91'></bdo><ul id='YKX91'></ul>

        <i id='YKX91'><tr id='YKX91'><dt id='YKX91'><q id='YKX91'><span id='YKX91'><b id='YKX91'><form id='YKX91'><ins id='YKX91'></ins><ul id='YKX91'></ul><sub id='YKX91'></sub></form><legend id='YKX91'></legend><bdo id='YKX91'><pre id='YKX91'><center id='YKX91'></center></pre></bdo></b><th id='YKX91'></th></span></q></dt></tr></i><div id='YKX91'><tfoot id='YKX91'></tfoot><dl id='YKX91'><fieldset id='YKX91'></fieldset></dl></div>

        UIWebView 加载进度并调整网页以适应视图页面?

        UIWebView loading progress and adjust web page to fit the view page?(UIWebView 加载进度并调整网页以适应视图页面?)

            <bdo id='HsRmP'></bdo><ul id='HsRmP'></ul>
              <tbody id='HsRmP'></tbody>

            <small id='HsRmP'></small><noframes id='HsRmP'>

          • <tfoot id='HsRmP'></tfoot>

              <i id='HsRmP'><tr id='HsRmP'><dt id='HsRmP'><q id='HsRmP'><span id='HsRmP'><b id='HsRmP'><form id='HsRmP'><ins id='HsRmP'></ins><ul id='HsRmP'></ul><sub id='HsRmP'></sub></form><legend id='HsRmP'></legend><bdo id='HsRmP'><pre id='HsRmP'><center id='HsRmP'></center></pre></bdo></b><th id='HsRmP'></th></span></q></dt></tr></i><div id='HsRmP'><tfoot id='HsRmP'></tfoot><dl id='HsRmP'><fieldset id='HsRmP'></fieldset></dl></div>
            • <legend id='HsRmP'><style id='HsRmP'><dir id='HsRmP'><q id='HsRmP'></q></dir></style></legend>
                • 本文介绍了UIWebView 加载进度并调整网页以适应视图页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在使用 UIWebView 加载网页.

                  I am using UIWebView to load a web page.

                  有3个问题:

                  1.UIWebView在加载页面时可以跟踪百分比进度吗?

                  1.It it possible to track the percentage progress when UIWebView is loading the page?

                  2.我注意到,当 Safari 加载网页时,URL 文本字段会显示一个蓝色背景进度指示器,告诉用户加载网页的百分比.这是什么技术?

                  2.I noticed that when Safari loading a web page, the URL textfield displays a blue background progress indicator to tell user the percentage of loading a web page. What is the technology for this?

                  3.我知道有属性 scalesPageToFit

                  3.I know there is property scalesPageToFit

                  scalesPageToFit一个布尔值,用于确定网页是否缩放以适应视图并且用户可以更改比例.

                  scalesPageToFit A Boolean value determining whether the webpage scales to fit the view and the user can change the scale.

                  我尝试将其设置为 YES,但它似乎不在公共 API 中,并且我的应用因黑屏而停止,我不确定是什么问题?

                  I try to set it to YES, but it looks like that it is not in public API and my app stopped with black screen, I am not sure what is wrong?

                  推荐答案

                  回答#1)

                  您可以使用 NSURLConnection 将网页作为 NSData 对象下拉,而不是使用 UIWebView.当您收到来自

                  Instead of using a UIWebView, you can pull the webpage down as an NSData object using an NSURLConnection. When you get the initial response from your request from

                  - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
                  

                  网络服务器应返回预期内容大小"的值(应包含在响应中).然后每次接收数据时都会不断调用以下方法:

                  the webserver should return a value of "expected content size" (which should be included in the response). Then you will keep getting the following method called each time you receive data:

                   - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
                  

                  继续将数据附加到现有的 NSMutableData 对象.然后您可以对照预期的响应大小检查当前数据对象 (NSMutableData.length) 的大小.

                  Keep appending the data to an existing NSMutableData object. Then you can check the size of your current data object (NSMutableData.length) against the expected response size.

                  percentage = (myData.length*100)/theResponse.expectedContentSize;
                  

                  然后您可以使用该百分比更新进度条!当

                  Then you can update a progress bar with that percentage! When

                  - (void)connectionDidFinishLoading:(NSURLConnection *)connection
                  

                  运行,用你的数据调用

                  [myWebView loadData:myData MIMEType:myMimeType textEncodingName:myEncoding baseURL:baseURL];
                  

                  它会将您下拉的所有内容加载到您的网络视图中.

                  and it will load everything you pulled down into your web view.

                  这篇关于UIWebView 加载进度并调整网页以适应视图页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Hardware Volume buttons change in app volume(硬件音量按钮更改应用程序音量)
                  Cocos2d - How to check for Intersection between objects in different layers(Cocos2d - 如何检查不同层中对象之间的交集)
                  Highlight Read-Along Text (in a storybook type app for iPhone)(突出显示朗读文本(在 iPhone 的故事书类型应用程序中))
                  Cocos2D + Disabling only Retina iPad Graphics(Cocos2D + 仅禁用 Retina iPad 图形)
                  Proper cocos2d scene restart?(正确的 cocos2d 场景重启?)
                  [ios.cocos2d+box2d]how to disable auto-rotation?([ios.cocos2d+box2d]如何禁用自动旋转?)
                  <tfoot id='LVb4P'></tfoot>

                  <small id='LVb4P'></small><noframes id='LVb4P'>

                    <bdo id='LVb4P'></bdo><ul id='LVb4P'></ul>
                    • <legend id='LVb4P'><style id='LVb4P'><dir id='LVb4P'><q id='LVb4P'></q></dir></style></legend>

                            <tbody id='LVb4P'></tbody>
                          <i id='LVb4P'><tr id='LVb4P'><dt id='LVb4P'><q id='LVb4P'><span id='LVb4P'><b id='LVb4P'><form id='LVb4P'><ins id='LVb4P'></ins><ul id='LVb4P'></ul><sub id='LVb4P'></sub></form><legend id='LVb4P'></legend><bdo id='LVb4P'><pre id='LVb4P'><center id='LVb4P'></center></pre></bdo></b><th id='LVb4P'></th></span></q></dt></tr></i><div id='LVb4P'><tfoot id='LVb4P'></tfoot><dl id='LVb4P'><fieldset id='LVb4P'></fieldset></dl></div>