回答

0

當然,爲什麼不重新分配你的新的UIViewController的數組到UITabBarController的viewControllers屬性?這將做到這一點。

- (void)addNewControllers { 
    NSMutableArray *controllers = [NSMutableArray array]; 
    UIViewController *c0 = [[[UIViewController alloc] init] autorelease]; 
    [controllers addObject: c0]; 

    UIViewController *c1 = [[[UIViewController alloc] init] autorelease]; 
    [controllers addObject: c1]; 

    UIViewController *c2 = [[[UIViewController alloc] init] autorelease]; 
    [controllers addObject: c2]; 

    [myTabBarController setViewControllers:controllers]; 
} 

瞭解更多關於潛在的副作用here

+0

即時通訊不知道如果我關注。你可以給我一個鏈接或提供示例代碼? – 2010-06-10 02:42:51

+0

當然 - 我編輯了一些代碼來看看我的回覆。 – randombits 2010-06-10 03:11:19

相關問題