美文网首页
WebView 高度计算

WebView 高度计算

作者: L_Divano | 来源:发表于2018-07-20 17:44 被阅读0次

``
CGFloat webViewHeight =[[webView stringByEvaluatingJavaScriptFromString:@"document.body.offsetHeight"]floatValue];

CGRect newFrame = webView.frame;

newFrame.size.height= webViewHeight;

webView.frame= newFrame;


CGSize actualSize = [webView sizeThatFits:CGSizeZero];

CGRect newFrame = webView.frame;

newFrame.size.height = actualSize.height;

webView.frame = newFrame;


_webView.scalesPageToFit = YES;

相关文章

网友评论

      本文标题:WebView 高度计算

      本文链接:https://www.haomeiwen.com/subject/wgmqmftx.html