0

我有一个带有标签栏的 UI 导航项目,每个标签栏都包含 XIB 和 ViewController,该项目通过此方法从 App 委托加载每个 ViewController:

MyFourthView *fourthViewController;
 fourthViewController = [[MyFourthView alloc] initWithTabBar];
localNavigationController = [[UINavigationController alloc]
                             initWithRootViewController:fourthViewController];
[localControllersArray addObject:localNavigationController];

现在我正在尝试将情节提要添加到我的项目中,并以编程方式从应用程序委托加载它以成为第五个选项卡栏视图,但我不知道该怎么做?因为storyBoard中没有XiB所以上面的方法行不通?

4

2 回答 2

2

如果您要添加到标签栏的第五个导航控制器是故事板中的根/初始视图控制器,您可以像这样实例化它:

UINavigationController *fifthNavigationController = [[UIStoryboard storyboardWithName:@"yourstoryboardname" bundle:nil] instantiateInitialViewController];

如果不是,给它一个故事板ID并像这样实例化它:

UINavigationController *fifthNavigationController = [[UIStoryboard storyboardWithName:@"yourstoryboardname" bundle:nil] instantiateViewControllerWithIdentifier:@"storyboardIdOfYourNavController"];
于 2013-03-07T02:04:09.267 回答
0

Apple 文档在此处切换为使用 Storyboard:http: //developer.apple.com/library/ios/#releasenotes/Miscellaneous/RN-AdoptingStoryboards/index.html

于 2013-03-07T01:47:21.187 回答