I have an app that works on landscape, already in the store, and decided to add a camera for a certain new feature in my next update.
The camera works perfect in my iPhone 3G and iPod 4S ( i have an ipad, but it doesn't has a camera), but one of my testers with an ipad 2 reported that the image inside the camera appears rotated 90 degrees in clockwise direction ( same for the small camera icon in the button). Even if the user rotates the ipad 2 the image always mantains that rotation. Once the picture is taken it appears it's saved correct position.
- Before giving more details, any idea of why i situation like this can happen ? ( that could help me to trace the problem). I just didn't know it was possible to rotate the preview image inside the camera !, and i'm currently clueless about what can cause to produce this behavior.
- It could be something related to my view controller ?. I'm returning NO for 'UIInterfaceOrientationPortrait' and 'UIInterfaceOrientationPortraitUpsideDown'. YES for 'UIInterfaceOrientationLandscapeLeft' and 'UIInterfaceOrientationLandscapeRight'. If understand correctly it's as it should be.
- The camera implementation is pretty straightfoward, just an UIImagePickerController. After creating it, i'm adding it as subview to an specific uiview that happens to be rotated 90 degrees Clockwise ( could this be the issue ?, but if it is, why it works correctly in my other devices with camera ?!). I tried to apply a transformation ( [picker view].transform = CGAffineTransformMakeRotation(M_PI);) but it had no effect.
By the time being i don't have an ipad 2 ( it's on it's way), but in the meantime i would like to solve the issue, or at least try to understand why it could be happening.
Thanks in advance.
Cheers !
Here's the code for the view controller method where i handle the rotation:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
if(interfaceOrientation == UIInterfaceOrientationLandscapeLeft)
{
return YES;
}
else if(interfaceOrientation == UIInterfaceOrientationLandscapeRight)
{
return YES;
}
else if(interfaceOrientation == UIInterfaceOrientationPortrait)
{
return NO;
}
else if(interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown)
{
return NO;
}
}