ios 根控制器(UINavigationController

2020-09-02  本文已影响0人  biubiuboom
- (BOOL)shouldAutorotate {
    return YES;
}

- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
    //判断当前顶层显示的是 你要设置横屏的那个控制器(FireAnimationViewController)
    if([self.selectedViewController isKindOfClass:[UINavigationController class]] && [[(UINavigationController *)[self selectedViewController] topViewController] isKindOfClass:[FireAnimationViewController class]]){
        return UIInterfaceOrientationMaskLandscape;
    }
    else{
        return UIInterfaceOrientationMaskPortrait;
    }
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
    return UIInterfaceOrientationPortrait;
}
上一篇 下一篇

猜你喜欢

热点阅读