Search code examples
iosuiimagepickercontrolleruiimageorientation

UIImagePickerController camera automatically converts image to portraitup


I have called a UIImagePickerController to take a photo but every time I take a photo, the camera automatically convert the image to portrait up although I want to take the image in the orientation it was taken.

In the didFinishPickingMediaWithInfo method, the returned image has the orientation UIImageOrientationUp every time.

In my parent controller, I have the following code:

-(BOOL)shouldAutorotate
{
    return YES;
}

-(NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskAll;
}

Solution

  • To rotate the UIImage to display properly when uploaded, you can use a category like this:

    UIImage+fixOrientation.h

    Here