Detecting iPhone camera orientation

后端 未结 3 1001
情书的邮戳
情书的邮戳 2021-02-11 07:42

I\'m getting inconsistent results depending on whether I get the image directly from the camera in the callback or choosing it from the camera roll.

In the UIImag

3条回答
  •  心在旅途
    2021-02-11 08:31

    I have tried the imageOrientation property after the picture has been taken, it's funny because I have the orientation values messed up. Up is Left, Down is Right, Left is Down and Right is Up, for example, if I hold the iPhone "Up" (the normal position) then imageOrientation is "UIImageOrientationRight".

    - (void)imagePickerController:(UIImagePickerController *)picker
      didFinishPickingImage:(UIImage *)image
          editingInfo:(NSDictionary *)editingInfo {
        switch (image.imageOrientation) {
          case UIImageOrientationUp: //Left
           break;
          case UIImageOrientationDown: //Right
           break;
          case UIImageOrientationLeft: //Down
           break;
          case UIImageOrientationRight: //Up
           break;
          default:
           break;
         }
    }
    

    Currently I am using 4.1 SDK GM (xcode_3.2.4_and_ios_sdk_4.1_gm_seed) targeting for iOS 3.1

提交回复
热议问题