如何在iPhone sdk中获取UIWebView的内容高度,objective-c? [英] How to get the content height of a UIWebView in iPhone sdk, objective-c?
本文介绍了如何在iPhone sdk中获取UIWebView的内容高度,objective-c?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可能重复:
如何确定UIWebView的内容大小?
Hai Guys,
我在将htmlString输入到UIWebView时遇到了问题,我在iphone中设置了webview的帧高是265总是。
I got a problem while lodaing the htmlString into UIWebView, I have set the frame height of a webview in iphone is 265 always.
webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 41, 320, 265)];
是否有任何属性可以获取UIWebView的内容高度。
Is there any property to get content height of a UIWebView.
如果我只得到一两行内容,那么它在两行之下看起来很奇怪。我怎样才能让它变得动态。请建议任何解决方案。
If I got the content only one or two lines then it is looking odd below the two lines. How can I make it dynamic. Please suggest any solution.
谢谢你,
Madan Mohan。
Thank you, Madan Mohan.
推荐答案
试试这个:
[webView stringByEvaluatingJavaScriptFromString:@"document.body.offsetHeight;"]
在 webViewDidFinishLoad
方法中。
这篇关于如何在iPhone sdk中获取UIWebView的内容高度,objective-c?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文