我正在做一個應用程序,但我仍然是一個初學者,我試圖去習慣RootViewController以及它應該如何設置。TabBarController和NavigationController
在開始我的應用程序啓動時,我希望在那裏有一個不在我的tabBarController(它被設置爲我的rootViewController)的View。
我想問的是,我可以有另一個視圖,它不在我的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";
[email protected]"LinkedIn";
[email protected]"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;
}
您使用的是什麼版本的XCode? – Dan
最新版本,4.6.2 – user2282749
你在使用故事板嗎? – Dan