竟然自动执行了js。只能贴图

- (CGFloat)tableView:(UITableView*)tableView heightForRowAtIndexPath:(NSIndexPath*)indexPath{
return self.webView.frame.size.height;
}
- (UIWebView*)webView{
if(!_webView) {
_webView = [[UIWebView alloc]initWithFrame:CGRectMake(0, 0, Main_Screen_Width, 1)];
_webView.delegate=self;
_webView.scrollView.scrollEnabled = NO;
}
return _webView;
}
#pragma mark - UIWebView Delegate Methods
-(void)webViewDidFinishLoad:(UIWebView*)webView
{
[MBProgressHUD hideHUDForView:self.VC.view animated:YES];
//获取到webview的高度
CGFloat height = [[self.webView stringByEvaluatingJavaScriptFromString:@"document.body.offsetHeight"] floatValue];
self.webView.frame = CGRectMake(self.webView.frame.origin.x,self.webView.frame.origin.y, Main_Screen_Width, height);
[self.detailTableView reloadData];
}
- (void)webViewDidStartLoad:(UIWebView*)webView
{
NSLog(@"webViewDidStartLoad");
[MBProgressHUD showHUDAddedTo:self.VC.view animated:YES];
}
- (void)webView:(UIWebView*)webView didFailLoadWithError:(NSError*)error;
{
NSLog(@"didFailLoadWithError===%@", error);
[MBProgressHUD hideHUDForView:self.VC.view animated:YES];
}
网友评论