Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

View size reduces after hiding tab bar

In my iPhone app.

I am using UINavigationControllers in UITabBarController.

Like:

Tab Bar:

  • Navigation Controller.

    • View Controller1.
  • Navigation Controller.

    • View Controller2.

View Controllerx from any of above view controllers.

When I navigates to the View Controllerx.

I am hiding the tab bar.

The problem is that tab bar is hiding but view size reduces. And white space appears at bottom.

[self.tabBarController.tabBar setHidden:YES];
[self.tabBarController.tabBar setFrame:CGRectZero];
[self.navigationController pushViewController:obj_tipcalc animated:YES];
[obj_tipcalc release];

enter image description here

Thanks.

like image 289
Arpit B Parekh Avatar asked Feb 20 '23 02:02

Arpit B Parekh


1 Answers

Your navigation controller's view lies within the view of your UITabBarController and it's not filling the entire screen. Simply try to resize it:

 ...
 CGRect biggerFrame = tabBarController.view.frame;
 biggerFrame.size.height += tabBarController.tabBar.frame.size.height;
 tabBarController.view.frame = biggerFrame ;
 ...

To bring back the original layout:

...
CGRect smallerFrame = tabBarController.view.frame;
smallerFrame.size.height -= tabBarController.tabBar.frame.size.height;
tabBarController.view.frame = smallerFrame;
...
like image 128
Norbert Avatar answered Feb 22 '23 18:02

Norbert