Classic answer:
I think you are probably looking for CALayer renderInContext:. Each UIView has a CALayer, which you can get through the layer property. That way, you can build the CGContext that you want (which is supposed to be a raster context) so that the presentation layer displays the view in context, and then do whatever you want with this data, split it into a bunch of UIImages and therefore , UIImageViews for the CoreAnimation effect, load it into OpenGL or something else.
Sample code is provided directly by Apple in Q & A 1703 , which uses the UIKit CoreGraphics extensions to go directly to UIImage and dig through all available windows to capture an entire screen image. But this shows you the essence of the matter.
Updated in 2015:
As in iOS 7, as described in Q & A 1817 , UIView provides -drawViewHierarchyInRect:afterScreenUpdates: which reduces the code needed for a snapshot, look even further - four lines in the Apple code example. Q&A 1703 seems to have been recalled as it is no longer available on the Apple side; The link above refers to an external archive copy. So, the advice of 1817 is something that must be observed.
Tommy source share