<legend id='Ba2tK'><style id='Ba2tK'><dir id='Ba2tK'><q id='Ba2tK'></q></dir></style></legend>

  1. <small id='Ba2tK'></small><noframes id='Ba2tK'>

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

      UIWebView 加载本地内容的延迟

      UIWebView delay in loading local content(UIWebView 加载本地内容的延迟)

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

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

                本文介绍了UIWebView 加载本地内容的延迟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我在 UIWebView 中显示了少量本地内容,大约 3 段文本和一个 100x100 像素的图像.当 UIWebView 被推送到导航控制器上时,大约需要半秒才能显示内容.这发生在设备上,而不是在模拟器中.显然 UIWebView 需要在显示内容之前做一些工作,但是在推送视图出现之前我有什么方法可以做到这一点吗?我自己没有运气.

                I'm displayed a small amount of local content in a UIWebView, roughly 3 paragraphs of text and one 100x100px image. When the UIWebView is pushed onto to the nav controller, it takes about half a second before the content is displayed. This occurs on the device, not in the simulator. Obviously the UIWebView needs to do some work before displaying the content, but is there some way I can do this before the pushed view appears? I have not had any luck doing this myself.

                这里是我创建和推送包含 UIWebView 的视图控制器的地方:

                Here is where I'm creating and pushing the view controller which contains the UIWebView:

                ArticleViewController* viewController = [[ArticleViewController alloc] init];
                viewController.article = article;
                [viewController view]; //touch the view so it gets loaded
                [viewController loadWebView]; //load the web view content
                [self.navigationController pushViewController:viewController animated:YES];
                [viewController release];
                

                这里是 loadWebView 方法:

                -(void)loadWebView {
                    NSString *path = [[NSBundle mainBundle] bundlePath];
                    NSURL *baseURL = [NSURL fileURLWithPath:path];
                
                    NSString* content = article.content;
                
                    NSString *html = [NSString stringWithFormat:@"
                                      <html><body style='background-color: transparent'><style type=""text/css"">body {font-family: helvetica; color: black; font-size: 10pt; margin: 10px 10px 10px 10px}</style>
                                      %@<div style='text-align:center'><a href='13443574_9709e4cf37.jpg?photographer=test' style='-webkit-tap-highlight-color:rgba(0,0,0,0);'><img src='13443574_9709e4cf37.jpg' height='160' width='230'></a></div></body></html>", content];
                    [self.webView loadHTMLString:html baseURL:baseURL];
                }
                

                之前我在viewDidLoad方法中有[viewController loadWebView],但是结果好像是一样的.推送 viewController 时出现空白屏幕,然后在半秒后加载内容.

                Previously I had [viewController loadWebView] in the viewDidLoad method, but the result seems to be the same. A blank screen when the viewController is pushed, followed by the content loading half a second later.

                有什么想法吗?

                推荐答案

                你要让用户等待,唯一的问题是:是在webview出现之前还是之后?如果您设置为之前",那么您应该创建控制器,加载 Web 视图,但等待推送它,直到 -webViewDidFinishLoad: 委托方法触发.收到后,您可以推送视图.

                You're going to make the user wait, the only question is: is it before or after the webview appears? If you're set on "before", then you should create the controller, load the web view, but wait to push it until the -webViewDidFinishLoad: delegate method fires. Once you receive that, you can push the view.

                这篇关于UIWebView 加载本地内容的延迟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                相关文档推荐

                Android - Is it possible to get install referrer programmatically(Android - 是否有可能以编程方式安装引荐来源网址)
                How to sign an APK with more than one certificate?(如何使用多个证书签署 APK?)
                What does this Google Play APK publish error message mean?(这个 Google Play APK 发布错误消息是什么意思?)
                Lost my keystore for uploaded app on android market(丢失了我在 android 市场上上传的应用程序的密钥库)
                App on Google Play always shows quot;Updatequot; instead of open(Google Play 上的应用程序总是显示“更新;而不是打开)
                How to restrict android app to specific device make?(如何将 android 应用程序限制为特定设备品牌?)

                <legend id='BP4l4'><style id='BP4l4'><dir id='BP4l4'><q id='BP4l4'></q></dir></style></legend>

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

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

                      <tbody id='BP4l4'></tbody>
                      1. <tfoot id='BP4l4'></tfoot>

                        • <bdo id='BP4l4'></bdo><ul id='BP4l4'></ul>