I have a UIView that has several UIImageViews as subviews. Each of these subviews has had different affine transform applied. I would like to take what amounts to a screen capture of my UIView, capturing it as a UIImage, or some other image representation.
The method I have tried already, rendering the layers to a CGContext with:
[view.layer renderInContext:UIGraphicsGetCurrentContext()];
doesn't preserve the positioning or other affine transformations of my subviews.
I would really appreciate a kick in the right direction.
Try this:
UIGraphicsBeginImageContext(self.view.frame.size);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With