title: renderInContext creating black background on background thread
body: <p>I'm drawing a view using renderInContext to create a screenshot for storage in core-data.</p>
  
  <p>I'm using this 'standard' code...</p>
  
  <pre><code>UIGraphicsBeginImageContextWithOptions( myview.bounds.size, YES, 0 );
  
  CGContextRef ctx = UIGraphicsGetCurrentContext();
  [myview.layer renderInContext:ctx];
  
  UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
  UIGraphicsEndImageContext();
  </code></pre>
  
  <p>Originally, I was doing this on the main thread which worked fine. However, as the view and its subviews became more complex (possibly hundreds of subviews with their own draw routines) the UI became too slow. So, I moved the rendering into a background thread.</p>
  
  <p>This works except for the background color of the view 'myview' is black, which isn't what I've set it to...white.</p>
  
  <p>With experimentation, I've noticed that if I pause my background thread for a second or two, the rendering is complete, with my background the required color.  This is kind-of-ok but as the view becomes more complex, the pause needs to be longer in order to get the correct image of the view and it's not really correct to have a time delay in which I need to 'up' as the view gets more complex.</p>
  
  <p>Has anyone got any suggestions how to resolve?</p>