I load photo from iPhone/iPad library, most of them in Portrait mode, I want to know How can I check the photo in Landscape or Portrait mode?
Use the imageOrientation
property of UIImage
instances. It is going to return you one of these constants.
Example:
UIImage *image = // loaded from library
if (image.imageOrientation == UIImageOrientationUp) {
NSLog(@"portrait");
} else if (image.imageOrientation == UIImageOrientationLeft || image.imageOrientation == UIImageOrientationRight) {
NSLog(@"landscape");
}