title: UIWebView - change size and fit content
body: <p>I want to download html content, then find out it's size (by calling javascript functions). After that I want to change <code>UIWebView</code> frame to that size. And html content should fill whole <code>UIWebView</code>. </p>
  
  <p>I read documentation and similar questions here on stackoverflow. Nothing helped. I don't want to call <strong>reload</strong> method and download HTML from server <strong>twice</strong>. I get correct width and height of html, but after changing <code>UIWebView</code> frame size, html content doesn't fill the frame. (this code below is called in <code>- (void)webViewDidFinishLoad:(UIWebView *)webView</code>)</p>
  
  <pre><code>NSNumberFormatter * f = [[NSNumberFormatter alloc] init];
  [f setNumberStyle:NSNumberFormatterDecimalStyle];
  NSNumber *width = [f numberFromString:[self.mediaWebView stringByEvaluatingJavaScriptFromString:@"getContentWidth()"]];
  NSNumber *height = [f numberFromString:[self.mediaWebView stringByEvaluatingJavaScriptFromString:@"getContentHeight()"]];
  
  self.mediaWebView.frame = CGRectMake(BORDER_WIDTH, BORDER_WIDTH, _frameWidth, _frameHeight);
  self.mediaWebView.bounds = CGRectMake(0, 0, _frameWidth, _frameHeight);
  </code></pre>
  
  <p>Init code:</p>
  
  <pre><code>self.mediaWebView = [[UIWebView alloc] initWithFrame:CGRectMake(BORDER_WIDTH, BORDER_WIDTH, _frameWidth, _frameHeight)];
  [self.mediaWebView setBackgroundColor:[UIColor clearColor]];
  [self.mediaWebView setOpaque:FALSE];
  [self.mediaWebView setUserInteractionEnabled:TRUE];
  self.mediaWebView.scrollView.scrollEnabled = FALSE;
  self.mediaWebView.scrollView.bounces = FALSE;
  self.mediaWebView.delegate = self;
  self.mediaWebView.contentMode = UIViewContentModeRedraw;
  self.mediaWebView.backgroundColor = [UIColor blackColor];
  
  
  NSString *stringUrl = @""// some URL
  
  NSURL *url = [NSURL URLWithString:stringUrl];
  [self.mediaWebView loadHTMLString:[self.questionView.question.mediaHtml description] baseURL:url];
  
  self.mediaWebView.scalesPageToFit = TRUE;
  
  [self addSubview:self.mediaWebView];
  </code></pre>