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
I have read somewhere that the UIImagePickerController doesn't turn on listening to hardware orientation events, so you may need to call
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
before you capture images in your own app. I'm about to go try testing this myself, so I hope it works!
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
I posted this to the Apple forums, and got the explanation:
"The camera is actually landscape native, so you get up or down when you take a picture in landscape and left or right when you take a picture in portrait (depending on how you hold the device)."
See:
https://devforums.apple.com/message/301160#301160
Thanks:
https://devforums.apple.com/people/Rincewind