2011-05-20 69 views
0

嗨,朋友,我有問題,這是可能在同一個應用程序中使用兩個不同的標籤欄類。 這意味着我的應用程序中有兩個tabbar控制器。 像1st一樣是newtabcontroller.h & newtabcontroller.m 2nd是oldtabcontroller.h & oldtabcontroller.m 可以在app中使用兩個不同的tabbarcontroller。 謝謝關於iphone中的tabBar控制器

+0

這看起來像是一個愚蠢的http://stackoverflow.com/questions/1907483/multiple-tab-bar-controller和其他人。 – CharlieMezak 2011-05-20 13:19:58

回答

0

爲什麼不呢? 但它不應該是另一個tabbarcontroller內的tabbarcontroller。

TabbarManager類。然後在一定條件下,負載 - FirstTabbarController或 - SecondTabbarController

所有組件和自己應該在TabbarManager類實例化的UITabbarControllers。 它的init可能有這樣的代碼,使兩個tabbarcontrollers類似。

self.tabBarController = [[UITabBarController alloc] init]; 
    self.controllers = [[NSMutableArray alloc] init]; 

// initialize the view controllers and navigation controllers for the tab bar 

self.friendsVC = [[FriendsVC alloc] initWithNibName:@"FriendsView" bundle:nil]; 
UINavigationController *friendsNVC = [[UINavigationController alloc] initWithRootViewController: friendsVC]; 
friendsNVC.navigationBar.barStyle = UIBarStyleBlack; 
[controllers addObject:friendsNVC]; 
[friendsNVC release]; 

self.paymentsVC = [[PaymentsVC alloc] initWithNibName:@"PaymentsView" bundle:nil]; 
UINavigationController *paymentsNVC = [[UINavigationController alloc] initWithRootViewController: paymentsVC]; 
paymentsNVC.navigationBar.barStyle = UIBarStyleBlack; 
[controllers addObject:paymentsNVC]; 
[paymentsNVC release]; 

tabBarController.viewControllers = controllers; 
tabBarController.selectedIndex = 0; 
tabBarController.delegate = self; 

self.view = tabBarController.view;