我有以下控制器,(我在 iPad 中选择了所有类型的方向模式)
这是我的 iPad 故事板布局
Custom NavigationController > Loading Ctrl > Main Controller.
我的自定义导航包含
-(BOOL)shouldAutorotate
{
return [[self.viewControllers lastObject] shouldAutorotate];
}
-(NSUInteger)supportedInterfaceOrientations
{
return [[self.viewControllers lastObject] supportedInterfaceOrientations];
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return [[self.viewControllers lastObject] preferredInterfaceOrientationForPresentation];
}
在我的加载控制器中
-(BOOL)shouldAutorotate
{
return YES;
}
-(NSUInteger)supportedInterfaceOrientations
{
if (UIUserInterfaceIdiomPad == UI_USER_INTERFACE_IDIOM())
return UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight;
else
return UIInterfaceOrientationMaskPortrait;
}
supportedInterfaceOrientations 像往常一样被调用,一切似乎都很好,但是当我使用 performSegue 推动我的主控制器时
-(NSUInteger)supportedInterfaceOrientations
{
if (UIUserInterfaceIdiomPad == UI_USER_INTERFACE_IDIOM())
return UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight;
else
return UIInterfaceOrientationMaskPortrait;
}
MainController 中不再有调用。这是为什么?