This question has been asked a lot and there are quite a few answers, but none of the answers I can find answer the following:
I have a UITabBarController
I want to hide the tab bar, so I call:
self.tabBarController.tabBar.hidden = YES
This removes the bar, but there is now an empty black box where the tab bar used to reside. I've tried resizing the frame of the ViewController that is currently being presented and it is always behind the black box left from the tab bar.
I also loop through all the subviews and hide them, no luck there.
Finally, I tried resizing the frame of the tabbar, and that doesn't do the trick either
Has anyone had any luck with this?
Also: hidesBottomBarWhenPushed doesn't work because the app isn't based on a UINavigationViewController, it is based on a UITabBarController.
This is an iPad app
Simply, Go to ViewController (in StoryBoard) -> Attribute inspector -> Under 'View Controller' section select 'Hide Bottom Bar on Push' checkbox. This works like a charm.
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.
Way 1: Touch “Settings” -> “Display” -> “Navigation bar” -> “Buttons” -> “Button layout”. Choose the pattern in “Hide navigation bar” -> When the app opens, the navigation bar will be automatically hidden and you can swipe up from the bottom corner of the screen to show it.
I had the same problem. Here is how I have gone about hiding the tab bar:
[self.tabBar removeFromSuperview];
UIView *contentView;
if ([[self.view.subviews objectAtIndex:0] isKindOfClass:[UITabBar class]]) {
contentView = [self.view.subviews objectAtIndex:1];
} else {
contentView = [self.view.subviews objectAtIndex:0];
}
contentView.frame = self.view.bounds;
This is called from the tabBarController (I have it subclassed), but it does remove the tabBar and resizes the view to get rid of that black bar you are seeing now. If you don't have a subclassed tabBarController, I'm sure you could just change all instances of self
to self.tabBarController
and it should work the same.
I hope this helps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With