My problem is this –
I have a UIImageView which a user can rotate freely.
I would now like to be able to capture just this newly rotated image.
The code below, which can take a screenshot of an individual view, unfortunately returns
a screenshot of the view in its unrotated state.
-(IBAction)captureScreen:(id)sender
{
UIGraphicsBeginImageContext(imgView.frame.size);
[imgView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *screenshot = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageWriteToSavedPhotosAlbum(screenshot, nil, nil, nil);
}
Any ideas how can I retain the rotation here?
Use your code on a view containing the rotated view not on the rotated view itself.