我有基于 TabBar 的 iPhone 应用程序,并且在应用程序委托中 2 个默认视图控制器由苹果初始化(如果您在创建应用程序时选择标签栏基础应用程序)。
UIViewController *rootViewController = [[tabBarBetFirstViewController alloc] initWithNibName:@"tabBarBetFirstViewController" bundle:nil];
UIViewController *accountViewController = [[tabBarBetSecondViewController alloc] initWithNibName:@"tabBarBetSecondViewController" bundle:nil];
为什么它没有像这样初始化:
tabBarBetFirstViewController *rootViewController = [[tabBarBetFirstViewController alloc] initWithNibName:@"tabBarBetFirstViewController" bundle:nil];
tabBarBetSecondViewController *accountViewController = [[tabBarBetSecondViewController alloc] initWithNibName:@"tabBarBetSecondViewController" bundle:nil];
???
那是一样的吗?还是只是苹果添加的那些默认值?如果我想再添加一个标签,我会写:
UIViewController *third = [ThirdViewController alloc].....];
或者
ThirdViewController *third = [ThirdViewController alloc]....];
当然最后我有:
self.tabBarController = [[UITabBarController alloc] init];
self.tabBarController.viewControllers = [NSArray arrayWithObjects:rootViewController, accountViewController, third, nil];