如何为标签栏控制器的每个导航设置相同的方向

时间:2018-04-20 16:45:34

标签: ios swift orientation landscape-portrait

如何在其他导航控制器中实现eletticitàTable的相同效果?我试图将func应用程序中的“if”更改为appdelegate,但无所事事。 我只是所有tabBar项目的导航控制器的第一页可以从纵向模式更改为横向模式。现在只有tabBar项elettricità表没关系。 我们能帮帮我吗? 抱歉我的英文不好

这是我的appdelegate代码:

func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
    if let tabBarController = window?.rootViewController as? UITabBarController {
        if let tabBarViewControllers = tabBarController.viewControllers {
            if let projectsNavigationController = tabBarViewControllers[1] as? UINavigationController {
                if projectsNavigationController.visibleViewController is ElettricitàTable  //use here your own ViewController class name

                {
                    return .all
                }

            }
        }
    }
    return .portrait
}

0 个答案:

没有答案