如何知道横向或纵向模式下的照片? [英] How to know if photo in Landscape or Portrait mode?
本文介绍了如何知道横向或纵向模式下的照片?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我从iPhone / iPad库加载照片,其中大部分都处于人像模式,我想知道如何在横向或纵向模式下查看照片?
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?
推荐答案
使用 UIImage
实例的 imageOrientation
属性。它会给你一个这些常量。
Use the imageOrientation
property of UIImage
instances. It is going to return you one of these constants.
示例:
UIImage * image = //从库中加载
UIImage *image = // loaded from library
if (image.imageOrientation == UIImageOrientationUp) {
NSLog(@"portrait");
} else if (image.imageOrientation == UIImageOrientationLeft || image.imageOrientation == UIImageOrientationRight) {
NSLog(@"landscape");
}
这篇关于如何知道横向或纵向模式下的照片?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文