title: Fitting UIWebView into UITableViewCell
body: <p>I want to add a UIWebView into a cell. THe HTML data will change and I will call reloadData when this happens.</p>
  
  <p>Problem is, the UIWebView changes nicely but I can't get the UITableViewCell to match the height properly. I've tried and failed at this solution...</p>
  
  <p>When webview loads:</p>
  
  <pre><code>- (void)webViewDidFinishLoad:(UIWebView *)aWebView {
      CGRect frame = aWebView.frame;
      int old_height = frame.size.height;
      frame.size = CGSizeMake(280, 0);
      aWebView.frame = frame;
      float content_height = [[aWebView stringByEvaluatingJavaScriptFromString:@"document.body.offsetHeight;"] floatValue];
      frame = aWebView.frame;
      frame.size = CGSizeMake(280, content_height + 20);
      aWebView.frame = frame;
      NSLog(@"SIZES - %i - %i",old_height + 4,(int) frame.size.height);
      if(old_height + 4 != frame.size.height){
          [self.tableView reloadData];
      }
  }
  </code></pre>
  
  <p>Returned height for cell:</p>
  
  <pre><code>return webview.frame.size.height + 20;
  </code></pre>
  
  <p>After the first load the cell is not sized properly. It's hard to figure out how to do this. I need to stretch the entire content downwards to fit a cell.</p>
  
  <p>Thank you.</p>