Created
October 28, 2014 22:41
-
-
Save conradev/1c40f006e14364015f99 to your computer and use it in GitHub Desktop.
UIImage+CGImagePropertyOrientation
This file contains 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
@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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
default is redundant.