简体   繁体   中英

Is it possible to push a UITabbarController from a UINavigationController?

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?

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM