Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the content height of a UIWebView in iPhone sdk, objective-c? [duplicate]

Possible Duplicate:
How to determine the content size of a UIWebView?

Hai Guys,

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)];

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.

Thank you, Madan Mohan.

like image 836
Madan Mohan Avatar asked Oct 01 '10 07:10

Madan Mohan


1 Answers

try this:

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

in your webViewDidFinishLoad method.

like image 67
MaxFish Avatar answered Sep 19 '22 19:09

MaxFish