views:

98

answers:

1

I have a UITabBarController that is loading a UINavigationController.

When I push a new view controller, is it possible to change the UITabBarController to a new set of tabs?

A: 

Sure, why not just re-assign your new UIViewController's array to UITabBarController's viewControllers property? That will do the trick.

- (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];
}

Read more about the potential side effects here.

Steve Finkelstein
im not sure if i follow. can you send me a link or provide sample code?
Sheehan Alam
sure - I edited my response with some code to take a look at.
Steve Finkelstein