更改内容大小的 iOS UIWebView [英] iOS UIWebView with changing content size
本文介绍了更改内容大小的 iOS UIWebView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个 UIWebView,我已经将 WebView 的高度设置为
I have a UIWebView which i've set the height of the WebView to
[[webView stringByEvaluatingJavaScriptFromString:@"document.body.offsetHeight"] floatValue];
这很好用,但在我的网页上我有一个可扩展的菜单,所以当网页改变它的高度时,WebView 不会增加/减少它的大小.
This works fine but on my webpage I have a menu which is expandable, so when the webpage is changing it's height the WebView doesn't increase/decrease it's size.
有什么技巧可以让我的 UIWebView 在网页改变大小时动态改变高度?
Any tips how I can make my UIWebView change height dynamically when the webpage is changing its size?
我非常希望保持 UIWebView 的大小 = 网页,这样我就不必在 WebView 中滚动.
I would very much like to keep the UIWebView's size = webpage so I never have to scroll in the WebView.
推荐答案
尝试设置其滚动视图的 contenSize:
Try setting the contenSize of its scrollview:
detailsWebView.scrollView.contentSize = CGSizeMake(detailsWebView.scrollView.contentSize.width,[[webView stringByEvaluatingJavaScriptFromString:@"document.body.offsetHeight"] floatValue]);
这篇关于更改内容大小的 iOS UIWebView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文