I was able to fix this by adding the following line before presenting and dismissing the view controller:
[UIViewController attemptRotationToDeviceOrientation];
It's hard to say exactly why this works. This call asks attempts to match the interfaceOrientation
to deviceOrientation
by calling shouldAutorotateToInterfaceOrientation:
and the subsequent rotation methods if YES
is returned.
It seems the interface and device orientations were getting stuck out of sync due to the workaround required to force an interface orientation in spite of the device orientation. Still shouldn't happen though in my opinion, as the workaround is still a legitimate use of the provided methods. It could be a bug in Apple's rotation/orientation stack.
Complete method:
- (void)forceOrientationChange
{
UIViewController *vc = [[UIViewController alloc] init];
[UIViewController attemptRotationToDeviceOrientation]; /* Add this line */
[self presentViewController:vc animated:NO completion:nil];
[UIView animateWithDuration:.3 animations:^{
[vc dismissViewControllerAnimated:NO completion:nil];
} completion:nil];
}