iPhone
iPhone

Reputation: 4170

How to Hide UITabbarController in iPhone

I have implemented UITabBarController in my applicationm. The code of it is as follows:

MainCollection *mainView = [[MainCollection alloc] initWithNibName:@"MainCollection" bundle:nil];
    UINavigationController *mainNav = [[UINavigationController alloc] initWithRootViewController:mainView];

    mainView = (MainCollection *)mainNav.topViewController;
    mainView.managedObjectContext = self.managedObjectContext;

    ShowFavourites *showVC = [[ShowFavourites alloc] initWithNibName:@"ShowFavourites" bundle:nil];
    UINavigationController *showNav = [[UINavigationController alloc] initWithRootViewController:showVC];
    showNav.title=@"Favourites";
     self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    UITabBarController *tabBar = [[UITabBarController alloc] init];

    [tabBar setViewControllers:@[mainNav,showNav]];

    [self.window setRootViewController:tabBar];

    [self.window makeKeyAndVisible];


    return YES;

My first Screen is MainCollection I should show tabBar in this view. suppose the next view is SubCategory but when I navigate to SubCategory, on this view I want to hide Tabbar then How can I hide it or remove it from only SubCategory view?

Any Idea?

Thanks in advance.

Upvotes: 1

Views: 3151

Answers (2)

Raj
Raj

Reputation: 1213

There is no need to hide the tabbar just use parent navigation controller for push to subcategory screen

[self.tabBarController.navigationController pushViewController:subCategoryObj animated:YES]; 

Thanks,

Upvotes: 3

IronManGill
IronManGill

Reputation: 7226

This has a very simple solution. You should have tried harder. In the View in which you want to hide the UITabBar simply add

self.hidesBottomBarWhenPushed = YES;

Here access these links for SO itself. You will easily find the answer :-

Show/Hide TabBarController in iphone

How to hide uitabbarcontroller

How to Hide Tab Bar Controller?

Is it possible to hide the tabbar when a button is pressed to allow a full screen view of the content?

How to hide UITabBarController programmatically?

How to hide an iPhone Tab Bar?

Upvotes: 5

Related Questions