title: How to delete the cache from UIWebview or dealloc UIWebview
body: <p>Every time I load a new page with <code>UIWebView</code> the before loaded page is shown for a short time. </p>
  
  <p>How can I clear that cache? Another possibility would be to dealloc <code>UIWebview</code>. I tried that but than my <code>UIWebView</code> is always "empty". How should the <code>alloc</code> and <code>dealloc</code> be done in this case?</p>
  
  <p>I noticed that the <code>UIWebView</code> is consuming about 10 MB RAM. Now the <code>UIWebView</code> is loaded together with the <code>ViewController</code>. And the view is autoreleased as well as the <code>UIWebView</code> is autoreleased. Wouldn't it be better to dealloc the WebView each time?</p>
  
  <p><strong>Solution:</strong></p>
  
  <pre><code>- (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;
  }
  </code></pre>