I am new to UIWebView and especially stringByEvaluatingJavaScriptFromString method.
In my layoutSubviews, I am calling my webview to get the frame size.
[self.body setFrame:CGRectMake(10.0f,10.0f,320.0f,[[_body stringByEvaluatingJavaScriptFromString:@"document.body.offsetHeight;"] floatValue])];
It tries to find the height but leaves lots of space in the view meaning it does not give the correct height with text string.
Now the above code works perfectly on iOS 4 and it does not work on iOS 5.
Is there any other way I can change the following to get it work on iOS 5 ?
First, evaluate your javascript on its own:
Make sure this is providing the correct value. I believe the JS engine was modified from 4.0 to 5.0 so it may be handling it differently.