I have a button that mirrors an image horizontally in an imageView. This means if it was an of me holding up my left hand, after clicking the button, it would seem like a picture of me holding up my right hand. The code executed by the button is show below.
Can someone explain why clicking the button the first time, mirrors the image correctly, but clicking it consecutive times does not result in it mirroring itself back and forth (nothing happens).
-(IBAction)mirrorImage3 {
UIImage * flippedImage = [UIImage imageWithCGImage:imageView.image.CGImage scale:imageView.image.scale orientation:UIImageOrientationUpMirrored];
imageView.image = flippedImage;
}
The orientation is a property of the
UIImage, not an instruction how to modify theCGImage. You’ll have to alternate betweenUIImageOrientationUpMirroredandUIImageOrientationUp.