title: Create a UIImage by rendering UIWebView on a background thread - iPhone
body: <p>Does someone know of a way, or has a creative idea as to how to obtain an UIImage that is rendered from a UIWebView? The catch is, that is must be on a background thread.</p>
  
  <p>I'll elaborate:
  I'm trying to obtain the image from multiple UIWebViews every second+-, and display it on screen (iPhone's of course). Because rendering a layer to a CGContext is a CPU consuming job, I wouldn't like to use the main thread, so not to hang the UI.</p>
  
  <p>My attempts so far were:</p>
  
  <ul>
  <li><p>I tried to use <code>renderInContext</code> on the webView's layer to the <code>UIGraphicalContext</code>, but the <code>_WebTryThreadLock</code> error crashed the webviews.</p></li>
  <li><p>I tried creating a <code>CGBitmapContext</code>, and render the webview's layer to it, but got the same result.</p></li>
  <li><p>I tried implementing a <code>copy</code> method (by adding a Category) to <code>CALayer</code>, that deep copied all of the public properties, and sublayers. Afterwards, I tried to <code>renderInContext</code> the layer I copied. I got a UIImage that was <strong>partially</strong> "correct" - meaning, not all of the layers were rendered, so for example, i would get only the website header (or footer, or body, or search bar, or just a some of the frames). The UIWebview's layer consists of all sort of subclassed CALayers, so this is probably why this approached didn't work.</p></li>
  <li><p>I tried setting the <code>kCATransactionDisableActions</code> in a <code>CATransaction</code>, but it didn't appear to change this behavior (neither of them).</p></li>
  </ul>
  
  <p>I'm pretty close to giving up.</p>
  
  <p>Is there a savior among you people?</p>