title: taking image snapshot of CATiledLayer-backed view in UIScrollView
body: <p>I've got a custom map view which is made of a <code>UIScrollView</code>. The scroll view's subview is backed by a <code>CATiledLayer</code>. Everything works great here. Panning &amp; zooming loads up new map tiles and everything performs well. </p>
  
  <p>What I want to do is capture frames of video of animations to this scroll view. Essentially, I want to create a video of animated changes to the scroll view's <code>contentOffset</code> and <code>zoomScale</code>. </p>
  
  <p>I know that the concept is sound as I can get the private API function <code>UIGetScreenImage()</code> to capture the app's screen at, say, 10fps, combine these images, and I get playback animations that are smooth and have the timing curves used by the scroll view animations. </p>
  
  <p>My problem, of course, is that I can't use the private API. Going through the alternatives outlined by Apple <a href="https://devforums.apple.com/thread/61338" rel="noreferrer">here</a> leaves me with pretty much one supposedly valid option: asking a <code>CALayer</code> to <code>renderInContext</code> and taking a <code>UIGraphicsGetImageFromCurrentImageContext()</code> from that. </p>
  
  <p>This just doesn't seem to work with <code>CATiledLayer</code>-backed views, though. A blocky, un-zoomed image is what is captured, as if the higher-resolution tiles never load. This somewhat makes sense given that <code>CATiledLayer</code> draws in background threads for performance and calling <code>renderInContext</code> from the main thread might not catch these updates. The result is similar even if I render the tiled layer's <code>presentationLayer</code> as well. </p>
  
  <p>Is there an Apple-sanctioned way of capturing an image of a <code>CATiledLayer</code>-backed view during the course of the containing scroll view's animations? Or at any point, for that matter? </p>