self.first_webview 为:web view height1 为:web view内容高度 self.scrollSuperView 为:滚动式图scrollview
1.
首先我们要在底部放一个scrollview,在上面放置一个webview,接下来便是禁止webview滚动。
2.
实现web view不滚动
UIScrollView *first_tempView = (UIScrollView *)[self.first_webview.subviews objectAtIndex:0];
first_tempView.scrollEnabled = NO;
遵守web view的协议
4.
计算web view内容的高度
- (void)webViewDidFinishLoad:(UIWebView *)webView{
height1 = [[self.first_webview stringByEvaluatingJavaScriptFromString:@"document.body.scrollHeight"] floatValue]; NSLog(@"self.first_webview = %f",height1);
}
这样便实现了webview不滚动,也能实现内容全部显示。
(项目里:驾校详情)