我的appDelegate.m中有这个代码,它实现了一个带UITabBarController的UINavigationController:
FristViewController *primeiro = [[FristViewController alloc] init];
UINavigationController *nav1 = [[UINavigationController alloc] init];
[nav1 pushViewController:primeiro animated:YES];
FilesViewController *segundo = [[FilesViewController alloc] init];
UINavigationController *nav2 = [[UINavigationController alloc] init];
[nav2 pushViewController:segundo animated:YES];
InfoViewController *terceiro = [[InfoViewController alloc] init];
UINavigationController *nav3 = [[UINavigationController alloc] init];
[nav3 pushViewController:terceiro animated:YES];
UITabBarController *tabbar = [[UITabBarController alloc] init];
tabbar.viewControllers = [NSArray arrayWithObjects:nav2, nav1, nav3, nil];
nav1.tabBarItem.image = [UIImage imageNamed:@"tab1.png"];
nav2.tabBarItem.image = [UIImage imageNamed:@"tab2.png"];
nav3.tabBarItem.image = [UIImage imageNamed:@"tab3.png"];
self.window.rootViewController = tab bar;
这个代码没问题,在我的情况下,我开始在第一个控制器上出现的应用程序是FilesViewController,因为它是Tab Bar顺序中的第一个,但在我的情况下我想要第一个controller是FristViewController而不改变标签栏中项目的顺序,我该怎么做?
答案 0 :(得分:1)
转到您创建TabBar的故事板或xib。将First控制器拖动到第1个位置。或者以编程方式设置tabBar.selectedIndex = 0;