<bdo id='BZskS'></bdo><ul id='BZskS'></ul>
    1. <small id='BZskS'></small><noframes id='BZskS'>

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

        如何从 UIWebview 或 dealloc UIWebview 中删除缓存

        How to delete the cache from UIWebview or dealloc UIWebview(如何从 UIWebview 或 dealloc UIWebview 中删除缓存)
        <legend id='w3BuA'><style id='w3BuA'><dir id='w3BuA'><q id='w3BuA'></q></dir></style></legend>
        <i id='w3BuA'><tr id='w3BuA'><dt id='w3BuA'><q id='w3BuA'><span id='w3BuA'><b id='w3BuA'><form id='w3BuA'><ins id='w3BuA'></ins><ul id='w3BuA'></ul><sub id='w3BuA'></sub></form><legend id='w3BuA'></legend><bdo id='w3BuA'><pre id='w3BuA'><center id='w3BuA'></center></pre></bdo></b><th id='w3BuA'></th></span></q></dt></tr></i><div id='w3BuA'><tfoot id='w3BuA'></tfoot><dl id='w3BuA'><fieldset id='w3BuA'></fieldset></dl></div>

              <tbody id='w3BuA'></tbody>

            <tfoot id='w3BuA'></tfoot>

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

              <bdo id='w3BuA'></bdo><ul id='w3BuA'></ul>

                  本文介绍了如何从 UIWebview 或 dealloc UIWebview 中删除缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  每次我使用 UIWebView 加载新页面时,之前加载的页面都会显示一小段时间.

                  Every time I load a new page with UIWebView the before loaded page is shown for a short time.

                  如何清除该缓存?另一种可能性是释放 UIWebview.我试过了,但我的 UIWebView 总是空的".这种情况下allocdealloc应该怎么做呢?

                  How can I clear that cache? Another possibility would be to dealloc UIWebview. I tried that but than my UIWebView is always "empty". How should the alloc and dealloc be done in this case?

                  我注意到 UIWebView 消耗了大约 10 MB RAM.现在 UIWebViewViewController 一起加载.并且视图是自动发布的,并且 UIWebView 是自动发布的.每次释放 WebView 不是更好吗?

                  I noticed that the UIWebView is consuming about 10 MB RAM. Now the UIWebView is loaded together with the ViewController. And the view is autoreleased as well as the UIWebView is autoreleased. Wouldn't it be better to dealloc the WebView each time?

                  解决方案:

                  - (void) viewWillAppear:(BOOL)animated {
                      [super viewWillAppear:animated];
                  
                      CGRect frame = CGRectMake(0, 0, 320, 480);
                      self.webView = [[[UIWebView alloc]initWithFrame:frame] autorelease];
                      self.webView.scalesPageToFit = YES;
                      [self.view addSubview:self.webView];
                  }
                  
                  - (void) viewDidDisappear:(BOOL)animated {
                      [super viewDidDisappear:animated];
                  
                      [self.webView removeFromSuperview];
                      self.webView = nil;
                  }
                  

                  推荐答案

                  我对这个问题的解决方案是在 viewWillAppear: 上以编程方式创建 UIWebView 并在viewDidDisappear:,像这样:

                  My solution to this problem was to create the UIWebView programmatically on viewWillAppear: and to release it on viewDidDisappear:, like this:

                  - (void) viewWillAppear:(BOOL)animated {
                      [super viewWillAppear:animated];
                  
                      self.webView = [[[UIWebView alloc]initWithFrame:exampleFrame] autorelease];
                      self.webView.scalesPageToFit = YES;
                      self.webView.delegate = self;
                      self.webView.autoresizingMask = webViewBed.autoresizingMask;
                      [exampleView addSubview:self.webView];
                  }
                  - (void) viewDidDisappear:(BOOL)animated {
                      [super viewDidDisappear:animated];
                  
                      [self.webView removeFromSuperview];
                      self.webView.delegate = nil;
                      self.webView = nil;
                  }
                  

                  如果你这样做并且你的 UIWebView 没有被释放,你应该检查它的保留计数并了解谁在保留它.

                  If you do this and your UIWebView doesn't get released you should check it's retain count and understand who is retaining it.

                  这篇关于如何从 UIWebview 或 dealloc 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 图形)
                  How to convert 32 bit PNG to RGB565?(如何将 32 位 PNG 转换为 RGB565?)
                  Proper cocos2d scene restart?(正确的 cocos2d 场景重启?)

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

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

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

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