2012-04-12 18 views
0

我想讓應用程序在第三個標籤欄上打開,而不是第一個。無論我將這些應用程序放在標籤欄上的順序如何,左邊的第一個總是首先打開。誰能幫忙?以下是標籤條形碼。如何在特定標籤欄上打開應用程序? iOS Objective-C

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 
// Override point for customization after application launch. 

UIViewController *viewController1 = [[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil]; 

UIViewController *viewController2 = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil]; 

UIViewController *viewController3 = [[ThirdViewController alloc] initWithNibName:@"ThirdViewController" bundle:nil]; 

UIViewController *viewController4 = [[FourthViewController alloc] initWithNibName:@"FourthViewController" bundle:nil]; 

UITableViewController *viewController5 = [[FifthViewController alloc] initWithNibName:@"FifthViewController" bundle:nil]; 


self.tabBarController = [[UITabBarController alloc] init]; 
self.tabBarController.viewControllers = [NSArray arrayWithObjects:viewController3, viewController4, viewController1, viewController2, nil]; 
self.window.rootViewController = self.tabBarController; 

回答

5

你嘗試

[self.tabBarController setSelectedIndex:2]; 
1

只需添加[self.tabBarController setSelectedIndex:2];

2,因爲數組從0開始;

相關問題