回答

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

相关问题