How to flip the UIImage
horizontally, I found UIImageOrientationUpMirrored
enumeration value in the UIImage
class reference, how to make use of this property to flip UIImage
.
Objective-C
UIImage* sourceImage = [UIImage imageNamed:@"whatever.png"];
UIImage* flippedImage = [UIImage imageWithCGImage:sourceImage.CGImage
scale:sourceImage.scale
orientation:UIImageOrientationUpMirrored];
Swift
let flippedImage = myImage.withHorizontallyFlippedOrientation()