两个UITabBarControllers和Autorotation [英] Two UITabBarControllers and Autorotation

查看:62
本文介绍了两个UITabBarControllers和Autorotation的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的mainwnidow.nib中有两个UITabBarControllers连接到我的appdelegate。

I have two UITabBarControllers in my mainwnidow.nib wired to my appdelegate.

在我的应用程序委托中,我可以加载其中一个:

In my app delegate, I can load either one:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    

//either
     [window addSubview:tabBarController.view];
//or
     [window addSubview:tabBar2Controller.view];
[window makeKeyAndVisible];
}

并自动旋转。

如果我同时添加两者(期望以后再交换):

If I add both (with the expectation to swap between them later):

 [window addSubview:tabBarController.view];
 [window addSubview:tabBar2Controller.view];

然后自动旋转停止工作...一切始终都是肖像。

then autorotation stops working...everything is always portrait.

在此先感谢任何提示...

Thanks in advance for any tips...

推荐答案

经过更多考虑之后,我意识到我可以只需切换出tabBarController.viewcontrollers数组即可。

After thinking it through more, I realized I could just switch out the tabBarController.viewcontrollers array.

在IB中,我将两组选项卡都添加到了一个选项卡中,然后appdelegate将它们分成两个数组,并在它们之间进行交换

In IB I added both sets of tabs to a single tabbar, and then the appdelegate seperates them into two arrays and swaps between them as needed.

工作正常,但对于用户界面是否有效尚无定论

It works fine, but the jury is still out on whether the UI is effective

这篇关于两个UITabBarControllers和Autorotation的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆