Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I have a UITabBar in the detail view of my navigation based application. I am storing text and images in a tableview and would like the user to be able to tap on a cell to hide the navigation controller and the tabbar for full screen viewing of the content.

I found this code for hiding the top bars, but it does not seem as easy to hide the tabbar.

[[UIApplication sharedApplication] setStatusBarHidden:YES animated:YES];
 [self.navigationController setNavigationBarHidden:YES animated:YES];

Does anyone know how to do this?

This code does not work to hide the tabBar once the view is already loaded.

  yourTabViewController.hidesBottomBarWhenPushed = YES;

This is the code I found. Seems to only work when the view is loaded though, so it can't be used to hide the tabbar once it has already appeared. I'm still struggling to make this work. Please help!!!

    self.tabBarController.tabBar.hidden = YES;
like image 429
Jonah Avatar asked Jul 30 '09 21:07

Jonah


People also ask

How do you hide the tab bar when a view controller is shown?

If you don't want that behavior, you should set hidesBottomBarWhenPushed to true where applicable. This will hide the tab bar along with any toolbars you had showing, but only when a view controller is pushed onto the navigation stack. This allows you to show the tab bar at first, then hide it when you need more room.

How do I hide a Tabbar in Swift?

vc. hidesBottomBarWhenPushed = true should do the work. DO NOT manually show and hide the tabbar.


1 Answers

There's a built-in way to do this:

self.hidesBottomBarWhenPushed = YES;

But you have to do this BEFORE the view is pushed. This is how you might want to use that:

ChildViewController* childVC = [[ChildViewController alloc] init];
childVC.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:childVC animated:YES];
[childVC release];
like image 124
Joseph Lin Avatar answered Sep 28 '22 18:09

Joseph Lin