[英]How do I find the height of a WebView's content at the current width?
我想垂直调整WebView的大小以适合其内容。 如何找出最佳高度?
我尝试查看WebFrame的frameView,但这只是它在其中显示的视图的大小, [frameView intrinsicContentSize]
始终返回-1,-1。
更新:
我可以做这个:
DOMNode *bodyNode = [[[frame DOMDocument] getElementsByTagName:@"body"] item:0]; float scrollHeight = [[bodyNode valueForKey:@"scrollHeight"] floatValue];
..但即使内容明显较短,我得到的结果也不会低于WebView的高度。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.