if (!webviewHasLoaded && pdIntroduce.length>0) { webView = [[UIWebView alloc]initWithFrame:CGRectMake(10, 30 , DEVW-20, webviewH)]; webView.delegate = self; [webView loadHTMLString:pdIntroduce baseURL:nil]; webviewHasLoaded = YES; } [cell.contentView addSubview:webView];//当reload的时候,如果重新创建了cell,就必须把 cell.contentview放在{}外面。
- (void)webViewDidFinishLoad:(UIWebView *)wb { NSString *height_str = [wb stringByEvaluatingJavaScriptFromString:@"document.body.offsetHeight"]; //document.body.offsetHeight获取页面高度信息 int temp = (int)height_str.integerValue + 10; if (temp != webviewH) { webviewH = temp; webView.frame = CGRectMake(10,30, DEVW-20, webviewH); //webviewHasLoaded=NO; webView.scrollView.scrollEnabled = NO; //禁止滚动 [TrainTab reloadData]; }
js获取浏览器基本信息:document.body.clientWidth/clientHeight/scrollWidth/scrollTop:
http://blog.csdn.net/zjlovety/article/details/6641644
时间: 2024-11-06 10:41:39