我的应用程序支持纵向和横向两种方向。我正在使用以下代码从位于UITabBarController中的UIViewController模态呈现一个UIViewController:
self.modalViewController = [[ModalViewController alloc] init];
[self presentViewController:self.modalViewController animated:YES completion:^{
}];
ModalViewController是一个控制器,用户只能在横屏模式下看到。它应该能够从LandscapeRight旋转到LandscapeLeft。它的外观如下:
@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
控制器从左侧滑出并且在95%的时间内完全覆盖屏幕。但是5%的时间,它从底部滑出并且只覆盖屏幕顶部的一半。
以下是正常工作时的界面:
以下是它运行不良时的外观:
我创建了一个示例项目,可以在这里找到:https://github.com/TitouanVanBelle/Bug 有一个UI测试目标,以帮助重现问题,但它很少起作用。有人知道为什么会发生这种情况吗?