[英]iOS SDK UITabBarController only shows one of two UIViewControllers
I am trying to make an iPhone application with two tabs: One for the game, and one for the instructions. 我试图制作一个带有两个选项卡的iPhone应用程序:一个用于游戏,一个用于说明。
However, when I add the UIViewControllers using 但是,当我使用添加UIViewControllers时
[_tabBarController setViewControllers:[NSArray arrayWithObjects:self.viewController, self.viewController2, nil] animated:NO]
it only shows the first one. 它只显示第一个。
I have tried simply setting the title property of each of my view controllers then adding them, I have tried doing 我试过简单地设置每个视图控制器的title属性,然后添加它们,我试着做
[_viewController setTabBarItem:[[UITabBarItem alloc] initWithTitle:@"something" image:nil tag:0]]
And also tried doing the previous operation in the initWithNibNamed: bundle:
method. 并且还尝试在initWithNibNamed: bundle:
方法中执行之前的操作。
However, nothing I do seems to allow me to show more than the one tab on the screen. 但是,我所做的一切似乎都无法允许我在屏幕上显示多个标签。
Any help is greatly appreciated. 任何帮助是极大的赞赏。
Thanks, 谢谢,
Michael. 迈克尔
Is viewController2 nil and it just didn't load? 是viewController2为零,只是没有加载? Make sure you have it properly connected when using IB. 使用IB时,请确保已正确连接。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.