I need to capture part of a large UIView that is inside a UIScrollView.
I used the CALayer renderInContext: method with over 2 years. Even if the method could not display special objects (for example, MapView) in 99% of cases, it was ideal and fast enough for my needs.
But with iOS7, the rendering of many components is completely buggy (and has gotten worse with the latest versions of iOS 7.1). So I wanted to use new methods that seem to be more dedicated to this, like UIView drawViewHierarchyInRect:afterScreenUpdates .
Unfortunately, I canβt get it to work on real devices, it displays black images (empty content). It works like a charm only on a simulator (retina or not), and, I think, there is no retina on real networks (I tested on the first iPad iPad mini) ... To summarize:
- The iPad simulator works.
- The iPad retina simulator works.
- iPad mini (1st gen) works
- iPad 3 and 4 gen not working
- iPad Air does NOT work
Here you can find a simple Xcode project that shows the problem.
Run it on the simulator, and then on the real (mesh) device to see the differences and the problem.
I added two screenshots at the end of this post, showing this. The left images show the result using the renderInContext: method, the right shows the result of the drawViewHierarchyInRect:afterScreenUpdates .
I scratched my head for so long! I even asked for help through the Apple DTS, which was rejected, stating that it sounds like an Apple error, and that I have to fill out a bug report (a thing that I did a long time ago).
If you have ideas, comments, etc., I would be very grateful.
thanks

