I am trying to programmatically save an image of the current view to a UIImage. the current view contains a background, and a number of UIImageViews that have had a 3d transformation applied to the layer, e.g.
CATransform3D t = CATransform3DIdentity;
t = CATransform3DRotate(t, rotationX, 1.0, 0, 0);
t = CATransform3DRotate(t, rotationY, 0, 1.0, 0);
object.layer.transform = t;
I am currently grabbing a screenshot of the current view with the following code:
UIGraphicsBeginImageContext(background.bounds.size);
[background.window.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
However, the 3d transformations on the objects are lost, e.g. the objects appear in the saved image as if no 3d transformations have been applied. Is there a way to grab a screen shot programmatically that will include the 3d transformations?
UIGetScreenImage() is not an option as that is a private API and this app is going to the app store.