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 know it's an iOS bug, but i've implemented a temporary fix:
on the view that presents the image picker, add this code if you don't get any orientation changes events (or use didRotateFromInterfaceOrientation otherwhise):
- (void)viewDidLoad {
[super viewDidLoad];
// ....
if ([[UIDevice currentDevice].systemVersion floatValue] >=8) {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didRotate:) name:UIDeviceOrientationDidChangeNotification object:nil];
}
}
now on rotation simply dismiss and represent your imagepicker:
- (void)didRotate:(NSNotification *)notification
{
if (self.presentedViewController && self.presentedViewController==self.imagePickerController) {
[self dismissViewControllerAnimated:NO completion:^{
[self presentViewController:self.imagePickerController animated:NO completion:nil];
}];
}
}
works a bit rough, but this is the best solution i've found