objective-c - iOS开发,如何让UIWebView高度自适应内容(HTML文本)?
PHPz
PHPz 2017-04-18 09:39:47
0
1
603
PHPz
PHPz

学习是最好的投资!

reply all(1)
巴扎黑

Does the height of the frame of UIWebview change according to the internal html?

My approach is generally to let the webview load HTML first, and then the controller becomes the delegate of the webview.
In the webViewDidLoad method, get the height of the webview after loading through js, and then refresh the page. At this time, set the frame for the webView .size.height can be equal to the height you obtained through js before

_webViewHeight = [[webView stringByEvaluatingJavaScriptFromString:@"document.body.offsetHeight"] floatValue];

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template