简体   繁体   中英

Hide a Tab on tabBarController from a view controller

Is it possible to hide / deactivate a Tab on a UITabBarController ??

And how?

It's possible to deactivate it, use following delegate method:

- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController; 
{
    if (viewControllerYouWantToDeactivate == viewController)
    {
        return NO;
    }
    else
    {
        return YES;
    }   
}

Don't forget to set delegate of your UITabBarController .

You can find delegate documentation 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