UIWebVIew 实现了UIScollView的委托协议,所以UIWebView和UIScollView一样,是可以拖动的。但是,如果UIWebView是嵌套在UIScrollView里的,那我们是不希望UIWebView可以滑动。这时候就要获取UIWebView加载后的实际高度。代码如下:
-(void)webViewDidFinishLoad:(UIWebView *)webView{
CGFloat webViewHeight=[webView.scrollView contentSize].height;
CGRect newFrame = webView.frame;
newFrame.size.height = webViewHeight;
webView.frame = newFrame;
}