I have a custom map view that is made from UIScrollView. Scrolling view preview supported CATiledLayer. Everything works fine here. Panning and zooming load new maps, and everything works well.
What I want to do is to capture the frames of the video animation into this scroll view. Essentially, I want to create a video of animated changes in the form of scroll contentOffsetand zoomScale.
I know the concept sounds like I can get a private API function UIGetScreenImage()to capture an application screen, say 10 frames per second, combine these images, and I get a playback animation that is smooth and uses timelines using scroll animation.
My problem, of course, is that I cannot use a private API. Passing the alternatives described by Apple here leaves me with quite a few acceptable options: ask CALayerbefore renderInContextand take UIGraphicsGetImageFromCurrentImageContext()from it.
This does not seem to work with CATiledLayer-backed views. A blocky, not enlarged image is what is captured, as if tiles with a higher resolution never load. This makes some sense, given that it CATiledLayeruses background threads for performance, and a call renderInContextfrom the main thread might not catch these updates. The result is similar even if I create a tiled layer presentationLayer.
Is there any way Apple authorized the capture of a CATiledLayer-backed view image while watching a scroll animation? Or at any moment, for that matter?
source
share