title: set dynamic UIWebView as header in TableView
body: <p>I set the UIwebview as a header in <code>UITableview</code>.<code>UIWebview</code> height and width are dynamic.Its come for local html files.</p>
  
  <p><code>UIWebview</code> and <code>UITableview</code> are under one scroll.</p>
  
  <p>It works fine for iphone.Same method I wrote for ipad  it works good.but one problem is there.
  In ipad Header view and table view alignment is not proper .</p>
  
  <p>Here is code.</p>
  
  <p>Rootviewcotrollor is <code>UITableviewControllor</code></p>
  
  <p>Rootviewcontroller.m</p>
  
  <pre><code> - (void)viewDidLoad {
  [super viewDidLoad];
  self.title = @"Webview in UITableView";
  webview = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 10)]; // Don't use CGRectZero here, won't work
  webview.delegate = self;
  webview.hidden = YES;
  
  [webview loadRequest:[[NSURLRequest alloc] 
                        initWithURL: [NSURL URLWithString:@"http://www.google.com/"]]];
  
  [self.tableView setTableHeaderView:webview]; // Leave this, else you'll have rows to fill the rest of the screen
  </code></pre>
  
  <p>}</p>
  
  <pre><code>- (void) webViewDidFinishLoad:(UIWebView *)webView {
  float newSize = [[webView stringByEvaluatingJavaScriptFromString:@"document.documentElement.scrollHeight"] floatValue];
  NSLog(@"Resizing webview from %.2f to %.2f", webView.frame.size.height, newSize);
  webView.frame = CGRectMake(webView.frame.origin.x, webView.frame.origin.y, webView.frame.size.width, newSize);
  webView.hidden = NO;
  
  // We need to reset this, else the new frame is not used.
  [self.tableView setTableHeaderView:webview];
  </code></pre>
  
  <p>}</p>
  
  <p>For same code iphone output</p>
  
  <p><img src="https://i.stack.imgur.com/v0nTT.png" alt="enter image description here"></p>
  
  <p>And iPad output <code>UITableview</code> start slider ahead of the <code>UIWebview.</code></p>
  
  <p><img src="https://i.stack.imgur.com/C36aL.png" alt="enter image description here"></p>
  
  <p>I try to set frame of header but it's not working,it give webview and table view both have it's own scrollview which not needed.</p>
  
  <p>What is solution for it?</p>
  
  <p>Thank you.</p>