IOS TabBarController中是否容许单个viewController旋转屏幕

在AppDelegate实现方法以下:app

- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
    
    if ([window.rootViewController isKindOfClass:NSClassFromString(@"TabBarController")]) {
        
        UITabBarController * tabVC = (UITabBarController *)window.rootViewController;
        
        if (tabVC.selectedIndex == 0 || tabVC.selectedIndex == 1) {
            return UIInterfaceOrientationMaskAll;//这里须要支持旋转
        }
    }
            
    return UIInterfaceOrientationMaskPortrait;
            
}

关注新平台:http://www.toutiao.com/m51416718261/code

关注订阅号:从小就坏get

相关文章
相关标签/搜索