UITabBar leaves a white rectangle when hidden
Solution 1
I had this problem, and I've resolved it by changing tabbar's subview frame for my content view (there are 2 subviews in tab bar - content view (#0) and bar view (#1)):
[[self.tabBarController.view.subviews objectAtIndex:0] setFrame:FULLSCREEN_FRAME];
Solution 2
I had the same problem and found the answer here : UIView doesn't resize to full screen when hiding the nav bar & tab bar
just resize the tabbarcontroller view this when you hide the tabbar :
tabBarController.view.frame = CGRectMake(0, 0, 320, 480);
Solution 3
It seems to have the problem with hiding the Bottom bar as Tab bar.... which I was facing and googled a lot for this.I consider it as a bug with this tab bar.Then also....we can use some trick.....
You can try for this and will definitely help if you are trying to hide the tab bar and which leaves the white space..
for the hell of coding you need to write just
[self setHidesBottomBarWhenPushed:YES];
when you are pushing to other view,where you don't need the Tab bar just write it
twitDetObj=[[TwitDetail alloc] initWithNibName:@"TwitDetail" bundle:nil];
[self.navigationController pushViewController:twitDetObj animated:YES];
self.hidesBottomBarWhenPushed=YES;
[twitDetObj release];
Hope this will work for you.....
Solution 4
This one works for me:
[[self.tabBarController.view.subviews objectAtIndex:0] setFrame:CGRectMake(0, 0, 320, 480)];
I had this code within the tab's viewControllers.
Solution 5
NOTE - This solution is to just to remove white space left after hiding tab bar.
For hiding tab bar best solution is - @Michael Campsall answer here
The simplest solution to this is to change your view's(in my case its tableView) bottom constraints, instead of giving bottom constraints with BottomLayoutGuide give it with superview. Screenshots attached for reference.
Constraints shown in below screenshots creates the problem, change it according to next screenshot
Actual constraints to remove white space should be according to this(below) screenshot.
Comments
-
Tobster almost 2 years
I have been unable to google an acceptable solution to this that can be applied to my project.
My app is a graphing tool that has three tabs; one for the graph itself and the other two are for browse/search functions for things that can be added to the graph. All tabs are navigation controllers.
The tab for the graph itself, when in portrait mode, displays a small preview of the graph and lists details of each entity that is on the graph below, and displays the tab bar at the bottom.
When the user rotates into landscape mode the graph turns full screen and everything else, including the tab bar, disappears. This is where I'm having the problem, as the GLView for my graph is always obscured by a white rectangle where the tab bar was.
I have tried changing the size of the navigation controllers view to full screen, changing the size of the tab bar controllers' view to full screen, changing the frame size of the tab bar itself to CGRect(0,0,0,0), becoming emotionally distraught, banging my fists on the desk, shouting abusive language at the MacBook, etc; all to no avail.
How can I make it work?
-
Tobster about 14 yearsThat's what I'm doing to hide the tab bar, which successfully disappears; but leaves a white rectangle where it was.
-
Tobster about 14 yearsI would say it more or less appears to not occupy the space rather than be obscured by it, however graph.superview.frame = CGRect(0,0,480,320) does not work, neither does the same with self.view, self.superview, just about any other combination.
-
Tariq over 12 yearsThanks... i was struggling since last 2 hours
-
Dejell over 11 yearswhat is FULL_SCREEN_FRAME?
-
Dejell over 11 yearsor set 490 instead of 480 if you don't display status bar
-
yunas about 11 years@Odelya FULL_SCREEN_FRAME is your desired frame/rectangle.
-
Gustavo Barbosa about 9 yearsIt should be a comment. It is not answering the question.
-
elsurudo over 7 yearsThanks. THIS is the correct answer. All the others are hacks.