TabBar不應該啓用任何標籤,直到用戶點擊任何一個標籤, 下面是我寫的代碼來顯示標籤欄,但問題默認情況下它顯示第一個標籤。UITabBar Fuctionality
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
PeopleViewController *peopleViewController = [[PeopleViewController alloc] init];
UINavigationController *nav1 = [[UINavigationController alloc] initWithRootViewController:peopleViewController];
[peopleViewController setTitle:@"People"];
EventsViewController *eventsViewController = [[EventsViewController alloc] init];
UINavigationController *nav2 = [[UINavigationController alloc]initWithRootViewController:eventsViewController];
[eventsViewController setTitle:@"Events"];
ActiveViewController *activeViewController = [[ActiveViewController alloc] init];
UINavigationController *nav3 = [[UINavigationController alloc]initWithRootViewController:activeViewController];
[activeViewController setTitle:@"Active"];
MoreViewController *moreViewController = [[MoreViewController alloc] init];
UINavigationController *nav4 = [[UINavigationController alloc] initWithRootViewController:moreViewController];
[moreViewController setTitle:@"More"];
NSArray *arrViewControllers = [[NSArray alloc] initWithObjects:nav1,nav2,nav3,nav4, nil];
[tabBarController setViewControllers:arrViewControllers];
[self.window addSubview:tabBarController.view];
return YES;
}
這是UITabBarController的默認行爲,你是問如何改變這種行爲? – 2014-10-27 09:29:34
@Guillaume Algis是的,我想改變它。是否有可能改變這種情況?如果可能的話,請幫助我 – Madhu 2014-10-27 09:31:20