Skip to content

Instantly share code, notes, and snippets.

@conradev
Created October 28, 2014 22:41
Show Gist options
  • Save conradev/1c40f006e14364015f99 to your computer and use it in GitHub Desktop.
Save conradev/1c40f006e14364015f99 to your computer and use it in GitHub Desktop.
UIImage+CGImagePropertyOrientation
@implementation UIImage (CGImagePropertyOrientation)
- (CGImagePropertyOrientation)cgImagePropertyOrientation {
switch (self.imageOrientation) {
case UIImageOrientationUp:
return kCGImagePropertyOrientationUp;
case UIImageOrientationDown:
return kCGImagePropertyOrientationDown;
case UIImageOrientationLeft:
return kCGImagePropertyOrientationLeft;
case UIImageOrientationRight:
return kCGImagePropertyOrientationRight;
case UIImageOrientationUpMirrored:
return kCGImagePropertyOrientationUpMirrored;
case UIImageOrientationDownMirrored:
return kCGImagePropertyOrientationDownMirrored;
case UIImageOrientationLeftMirrored:
return kCGImagePropertyOrientationLeftMirrored;
case UIImageOrientationRightMirrored:
return kCGImagePropertyOrientationRightMirrored;
default:
return kCGImagePropertyOrientationUp;
}
}
@end
@guoxiucai
Copy link

default is redundant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment