Is there an alternative to the CALayer -renderInContext: method?
1 answer
Several, but start with:
UIGetScreenImage();
Returns CGImageRef. If you are using this, note that the image is saved and you must release it.
Edit
For completeness, add a basic other way to do it:
UIWindow *aWindow = [[UIApplication sharedApplication].windows objectAtIndex:0];
UIGraphicsBeginImageContext(aWindow.frame.size);
[[aWindow layer] renderInContext:UIGraphicsGetCurrentContext()];
UIImage *screenshot = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
+1
a source to share