Created
December 17, 2011 17:56
-
-
Save codeswimmer/1490871 to your computer and use it in GitHub Desktop.
iOS: mirror an image
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(UIImage *)makeMirroredImage:(UIImage *)image | |
{ | |
UIImageOrientation flippedOrientation = UIImageOrientationUpMirrored; | |
switch (image.imageOrientation) { | |
case UIImageOrientationDown: | |
flippedOrientation = UIImageOrientationDownMirrored; | |
break; | |
case UIImageOrientationLeft: | |
flippedOrientation = UIImageOrientationLeftMirrored; | |
break; | |
// ... | |
} | |
UIImage * flippedImage = [UIImage imageWithCGImage:image.CGImage scale:image.scale orientation:flippedOrientation]; | |
return flippedImage; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment