Skip to content

Instantly share code, notes, and snippets.

@codeswimmer
Created December 17, 2011 17:56
Show Gist options
  • Save codeswimmer/1490871 to your computer and use it in GitHub Desktop.
Save codeswimmer/1490871 to your computer and use it in GitHub Desktop.
iOS: mirror an image
-(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