NSString *htmlHeight = [webView stringByEvaluatingJavaScriptFromString:@"document.body.scrollHeight"];
//HTML5的宽度
NSString *htmlWidth = [webView stringByEvaluatingJavaScriptFromString:@"document.body.scrollWidth"];
//宽高比
float i = [htmlWidth floatValue]/[htmlHeight floatValue];
//webview控件的最终高度
float height = SCREEN_WIDTH/i;
self.cellheight=height;
self.webView.frame=CGRectMake(0, 0, SCREEN_WIDTH, self.cellheight);
[self.tableView reloadData];
网友评论