Skip to content

Instantly share code, notes, and snippets.

@odderlynat
Created November 30, 2011 00:52
Show Gist options
  • Save odderlynat/1407428 to your computer and use it in GitHub Desktop.
Save odderlynat/1407428 to your computer and use it in GitHub Desktop.
Resizing webview height based on content
- (void)webViewDidFinishLoad:(UIWebView *)webView {
CGFloat contentHeight = [[webView stringByEvaluatingJavaScriptFromString:
@"document.documentElement.scrollHeight"] floatValue];
webView.frame = CGRectMake(webView.frame.origin.x, webView.frame.origin.y,
webView.frame.size.width, contentHeight);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment