Hide tabbar in IOS7 shows informal behaviour
When I use
self.tabBarController.tabBar.hidden = YES;
Above code hides the tabBar, but my view from bottom does not remain interactive
But when I uses this just before pushing viewController in navigation
someViewController.hidesBottomBarWhenPushed = YES
[self.navigationController pushViewController:someViewController animated:YES];
It hides tabbar as well as view from bottom is also interactive. but problem in this case is, when we pop viewController it shows black bar just above tabbar for few seconds.
Use following code to resolve your problem
Hide :
Show :
Use this methods in viewWillAppear and on device rotation methods as per your requirement
I hope you got the solution. Just to make sure, did you try
So I've rewritten some of the answers written in Objective-C into Swift 3.0 thinking it would work. Here's the code:
Try this, if you want to hide/show the UITabBarController of view:
For hide the tabbar:
for show Tabbar:
may be it will help.
I think that both of you problems are due to not well defined/missing
autoresizingMask
's or missing auto-layout constraints (whichever you're using).What
UITabBarController
does when hiding the tab bar is to stretch itsview
enough to get the itstabBar
outside the screen. Your contained view controllers' views in turn should properly stretch to use the new space or you'll get empty spaces and/or non interactive zones.Edit:
Just realized that hiding the tab bar is not in the default SDK but in a category I made long time ago.
Anyway stretching
UITabBarController
's view frame seems to me the most elegant way to "hide" the tab bar (actually move it away from the screen) as you don't have to deal with subviews or hunt down the tab bar frame directly.