web的高度计算-cell-里面使用-只做记录

251 阅读1分钟

-(void)webViewDidFinishLoad:(UIWebView *)webView { //HTML5的高度 NSString *htmlHeight = [webView stringByEvaluatingJavaScriptFromString:@”document.body.scrollHeight”]; //HTML5的宽度 NSString *htmlWidth = [webView stringByEvaluatingJavaScriptFromString:@”document.body.scrollWidth”]; //宽高比 float i = [htmlWidth floatValue]/[htmlHeight floatValue];

//webview控件的最终高度 float height = screenWidth/i;

//后面的代码 //重新设置webView的高度,刷新tableView 设置cell的高度 _tuwenWeb.frame = CGRectMake(0, 0, self.view.frame.size.width, height); [self.tableView reloadData]; 。。。。。。

}