我在根级别有一个标签栏控制器。
假设其中一个标签显示“MainContainerViewController”。
在这个“MainContainerViewController”中,基本上我需要另外5个选项的“标签栏”。显然我不能在项目中有两个标签栏,所以我在“MainControllerViewController”下面放了一个工具栏。
5个选项中的每一个都应该显示一个独立的视图控制器,同时保持工具栏在下面。
在ios5和storyboard之前,我要做的是为5个视图控制器分配+ initWithNib,然后在单击按钮时将相应的viewcontroller视图添加到maincontainerviewcontroller的视图中。
但现在使用ios5和storyboard,我应该怎么做,因为对于所有这5个视图控制器我没有更多的笔尖?我应该如何在故事板中连接,以便“mainviewcontroller”将实例化这5个视图控制器,我稍后可以添加他们的视图。?
希望有人能理解我的问题......
P / S: 我不希望将5个视图控制器“推”到mainviewcontroller中...这是因为我不想要导航效果,我想始终保持工具栏下方。 因此我只想将子视图添加到MainContainerViewController的视图中......
答案 0 :(得分:1)
嗨,我找到了我需要的具体解决方案。
基本上我正在寻找的是这样的:
UIStoryboard *aStoryboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:[NSBundle mainBundle]];
childControllers = [NSArray arrayWithObjects:
[aStoryboard instantiateViewControllerWithIdentifier:@"0"],
[aStoryboard instantiateViewControllerWithIdentifier:@"1"],
[aStoryboard instantiateViewControllerWithIdentifier:@"2"],
[aStoryboard instantiateViewControllerWithIdentifier:@"3"],
nil];
谢谢你的帮助,hector。
答案 1 :(得分:0)
我认为您需要做的是在故事板中创建更多ViewControllers(5是您需要的)并使用segues连接它们。
我使用这个Apple教程学习了按照新故事板方式创建应用程序的新流程 - > https://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/SecondiOSAppTutorial/Introduction/Introduction.html
这个也很好 - > http://www.raywenderlich.com/5138/beginning-storyboards-in-ios-5-part-1