My application that supports both Portrait and Landscape orientations. I am presenting a UIViewController modally from a UIViewController located in a UITabBarController using the following code:
self.modalViewController = [[ModalViewController alloc] init];
[self presentViewController:self.modalViewController animated:YES completion:^{
}];
The ModalViewController is a controller that should only be seen by the user in Landscape. It should be able to rotate form LandscapeRight to LandscapeLeft. This is how it looks like:
@implementation ModalViewController
#pragma mark - UIViewController - Orientation
- (UIInterfaceOrientationMask)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape;
}
- (BOOL)shouldAutorotate
{
return YES;
}
#pragma mark - NSObject
- (void)viewDidLoad
{
[super viewDidLoad];
self.view.backgroundColor = [UIColor greenColor];
}
#pragma mark - UIViewController - Status Bar
- (BOOL)prefersStatusBarHidden
{
return YES;
}
@end
The controller slides up from the left side and covers the screen entirely 95% of the time. But 5% of the time, it slides up from the bottom and covers only the top half of the screen.
Here's how it looks when it's working fine:
And here's how it looks when it is not working fine:
I created a sample project that can be found here: https://github.com/TitouanVanBelle/Bug
There is a UI Testing target to help reproduce the issue but it rarely works.
Does anyone know why this is happening?