I have a very simple application:
- All orientations are permitted with only a button on a screen
- The button show a UIImagePickerController (to take a photo)
I found an easy and accurate patch to resolve this issue. Add following code before presenting UIImagePickerController:
if (iOS8_Device)
{
if([[UIDevice currentDevice]orientation] == UIDeviceOrientationFaceUp)
{
if([UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationLandscapeLeft)
{
[[UIDevice currentDevice]setValue:[NSNumber numberWithInteger:UIDeviceOrientationLandscapeRight] forKey:@"orientation"];
}
else
{
[[UIDevice currentDevice]setValue:[NSNumber numberWithInteger:UIDeviceOrientationLandscapeLeft] forKey:@"orientation"];
}
}
}
Also you need to subclass UIImagePickerController and override following method as below to work it better.
- (BOOL)shouldAutorotate
{
[super shouldAutorotate];
return NO;
}
After using above code it will work for both landscape orientation well and the orientation will not be changed to UIDeviceOrientationFaceUp mode.