Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/105.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 被纵向/横向模式照片的UIImageOrientation弄糊涂了_Ios_Objective C_Landscape Portrait_Uiimageorientation - Fatal编程技术网

Ios 被纵向/横向模式照片的UIImageOrientation弄糊涂了

Ios 被纵向/横向模式照片的UIImageOrientation弄糊涂了,ios,objective-c,landscape-portrait,uiimageorientation,Ios,Objective C,Landscape Portrait,Uiimageorientation,我使用ios的系统摄像头拍摄了两张照片,一张处于纵向模式,另一张处于横向模式,然后我使用imagePicker在我的应用程序中选择它们,如下所示: -(void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{ UIImage* sourceImage = [info objectForKey:UIImagePicker

我使用ios的系统摄像头拍摄了两张照片,一张处于纵向模式,另一张处于横向模式,然后我使用imagePicker在我的应用程序中选择它们,如下所示:

-(void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{

    UIImage* sourceImage = [info objectForKey:UIImagePickerControllerOriginalImage];


    UIImageOrientation imageOrientation = sourceImage.imageOrientation;
    NSLog(@"%d",imageOrientation);

}
请注意,我注销了刚刚拾取的图像的UIImageOrientation值。
结果是纵向模式照片的值为3(表示UIImageOrientationRight),横向模式照片的值为0(UIImageOrientationUp),我只是不明白为什么。有人能解释一下吗?谢谢

无论设备方向如何,iPhone的摄像头都会保存照片,但它会在图像中添加一个元信息,以便正确渲染此图像
imageOrientation
描述了正确渲染图像所需旋转的角度。

查看此主题此问题为我提供了正确答案。这个问题没有任何正当理由被否决。这是一个完全正确的问题谢谢@Max K。!因此,用于纵向照片的UIImageOrientationRight意味着系统必须将图像逆时针旋转90度才能正确渲染?是的,请查看
UIImage
参考了解更多信息。仔细阅读以了解这些常数的实际含义。它似乎保存为一幅风景画,这令人难以置信地困惑/奇怪??因此,始终默认的纵向模式是UIImageOrientationRight。我想。