我正在制作一个应用程序,但我仍然是初学者,我正在尝试习惯 RootViewController 以及应该如何设置它。
在我的应用程序启动之初,我希望有一个不在我的 tabBarController 中的视图(设置为我的 rootViewController)。
我想问的是,我可以先在我的 UITabBarController 启动之外有另一个视图,而不是在 tabBarController 的项目列表中吗?
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
FacebookFeedViewController *facebookClass = [[FacebookFeedViewController alloc] initWithNibName:@"FacebookFeedViewController" bundle:nil];
TwitterFeedViewController *twitterClass = [[TwitterFeedViewController alloc] initWithNibName:@"TwitterFeedViewController" bundle:nil];
LinkedInFeedViewController *linkClass = [[LinkedInFeedViewController alloc] initWithNibName:@"LinkedInFeedViewController" bundle:nil];
FTLFullFeedViewController *masterClass = [[FTLFullFeedViewController alloc] initWithNibName:@"FTLFullFeedViewController" bundle:nil];
/// tab button title
facebookClass.title = @"Facebook";
twitterClass.title = @"Twitter";
linkClass.title=@"LinkedIn";
masterClass.title=@"FTL";
// tab button Images
facebookClass.tabBarItem.image = [UIImage imageNamed:@"facebook_32"];
twitterClass.tabBarItem.image = [UIImage imageNamed:@"twitter_32"];
WelcomeViewController *welcomeClass= [[WelcomeViewController alloc] initWithNibName:@"WelcomeViewController" bundle:nil];
navController = [[ UINavigationController alloc] initWithRootViewController:welcomeClass];
UINavigationController *navController2 = [[UINavigationController alloc] initWithRootViewController:facebookClass];
UINavigationController *navController3 = [[UINavigationController alloc] initWithRootViewController:twitterClass];
UINavigationController *navController4 = [[UINavigationController alloc] initWithRootViewController:linkClass];
UINavigationController *navController5 = [[UINavigationController alloc] initWithRootViewController:masterClass];
self.tabBarController = [[UITabBarController alloc] init];
self.tabBarController.viewControllers = [NSArray arrayWithObjects:navController,navController5,navController2,navController3,navController4,nil];
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
return YES;
}