View size reduces after hiding tab bar

In my iPhone app.

I am using UINavigationControllers in UITabBarController.


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];



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;

It may be helpful.In ViewwillAppear set the frame.

Change the frame of the view after hiding tabbar:

CGRect *rect=view1.frame;

Just call loadView on the viewController contained in within the TabBar. This will reload the view with proper size

Need Your Help

An unhandled exception of type 'System.InvalidOperationException' occurred in System.Data.dll While writing from textbox to sql server 2012

c# sql sql-server wpf

Trying my first WPF textbox to SQL express connection. I am receiving a An unhandled exception of type 'System.InvalidOperationException' occurred in System.Data.dll While using sql 2012 express tr...

C# MySQL LINQ DateTime conversion

c# mysql date

I'm trying to retrieve records from a mySQL DB using LINQ and C#.