views:

808

answers:

1

I'm trying to get a UIImage of a UIWebView, I can do this fine using renderInContext:. However before I generate the image I would like to update the UIWebView with some HTML code, the trick is the UIWebView is hidden. Right now, I can not get the updated version of the web view to render in the UIImage, just the old one.

+1  A: 

Are you waiting until the UIWebView re-renders before querying it again? Loading HTML into a UIWebView does not immediately update the view. You need to wait for webViewDidFinishLoad:. This is true even if the HTML is a simple string with no external references.

Rob Napier
To add to this, it can take a long time to render a page (seconds), even if no network activity is happening.
Louis Gerbarg