I have a UIWebView inside a UITableViewCell. The height of the cell is based on the height of the web view, so I need to know how tall the web view will be after I load an HTML string into it.
Is there anyway to determine the height of the web view before webViewDidFinishLoad: is called?
I am afraid there is no way.
webViewDidFinishLoad:is called as soon as the HTML is fully loaded. To determine the height, the HTML has to be completely rendered by the UIWebView. And that can only start after the HTML has been loaded.In fact it may be even worse. Relying on
webViewDidFinishLoad:to determine the height of the HTML may cause varying results, because the HTML might still have to be rendered whenwebViewDidFinishLoad:is already being called.To be sure the height is correct you can use the following method that I have described a while ago in my blog.