作者热门文章
- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我使用 ios 的系统相机拍了两张照片,一张是纵向模式,另一张是横向模式,然后我使用 imagePicker 在我的应用程序中挑选它们,如下所示:
-(void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{
UIImage* sourceImage = [info objectForKey:UIImagePickerControllerOriginalImage];
UIImageOrientation imageOrientation = sourceImage.imageOrientation;
NSLog(@"%d",imageOrientation);
}
请注意,我 NSLog 输出了我刚刚挑选出的图像的 UIImageOrientation 值。结果是纵向模式照片的值为 3(表示 UIImageOrientationRight),横向模式照片为 0(UIImageOrientationUp) 我只是不明白为什么。谁能解释一下?谢谢!
最佳答案
iPhone 的相机无论设备方向如何都会保存照片,但它会向图像添加元信息以允许正确呈现此图像。 imageOrientation
描述图像应该旋转多少度才能正确呈现。
关于ios - 被纵向/横向模式照片的 UIImageOrientation 搞糊涂了,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17921789/
我是一名优秀的程序员,十分优秀!