I\'m currently using webView to display news,below the news I intend to put some buttons.so I need to get the height of webView so as to change the position of buttons accor
The webView has method sizeThatFits:
which returns the size of content once the webView is added in a view hierarchy and finished loading the html.
But this does not work without a caveat. You need to set the frame of webview to a low value before calling the fitting size method.
For eg: If you have a fixed width and variable height
//Set a very low height
CGRect webViewFrame = self.webView.frame;
webViewFrame.size.height = 5.0f;
self.webView.frame = webViewFrame;
//Re calculate the size that fits
CGSize size = [self.webView sizeThatFits:webViewFrame.size];
self.webViewFrame.size = size;
self.webView.frame = webViewFrame;
PS: I want to give credit to the original work. I'm still searching in SO