Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hiding Tabbar still occupy Space?

I am creating a navigation base application. I need to display a tab bar too.

My mainWindow.xib contains:

  • UINavigationController,
  • UITabBarController.

UITabBarController has three UINavigationController with it.

On a condition-based algorithm, I am displaying the Navigation and the TabBar.

It's working well. The problem occurs when I want to move any inner view of TabBar: it shows navigationBar there (what I need) but it shows TabBar too. I want to remove the TabBar of all inner view. When I hide the tabbar it still occupy its space at the bottom of view. I had tried to reset frame of View and Window but nothing helped.

How can I hide tabBar and use its space in my view?

Is the logic I am using correct or not? If not, please tell how to correct it. If there is a tutorial it would be better.

like image 435
Kapil Choubisa Avatar asked Nov 30 '25 01:11

Kapil Choubisa


2 Answers

You can try this:

yourInnerViewController.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:yourInnerViewController animated:YES];
like image 143
sycx Avatar answered Dec 03 '25 09:12

sycx


The answer is that you can't and trying to force it will break apple's HIG and they'll most probably reject your app.

The way I got around it was to use [self presentModalViewController:animated:] instead of [self.navigationController pushViewController:animated:].

I know its annoying, but a tab bar controller is there to switch between sections of your app. Therefore it provides functionality outside of the context of the navigation controllers within it and therefore cannot be hidden (properly) from inside one of those navigation controllers.

like image 27
Thomas Clayson Avatar answered Dec 03 '25 07:12

Thomas Clayson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!