I have a problem with UITabBarController
. In my application, I want to hide it but without using hidesBottomBarWhenPushed
because I want to hide it not when I pushed it. For Example, I want to hide it when I press a Hide button in my application.
I read many articles in google but I cant find out how I can do this.
@karlbecker_com Answer works perfect for both the iPhone 4 and iPhone 5. If anyone is having issues with iOS7 black bar at the bottom set the tabBarController to translucent
I am pasting this from my working code... you can call these methods to hide and show the tabbarcontroller.... just pass tabbarcontroller instance to these functions..
Hiding the tab bar is not an adequate solution, it won't adjust the current view controllers view height.
Instead you may simply transform the tab bar itself, either by it's height (to hide) or an identity transform to reset to visible.
Note that you may need to set your view controller to 'extends below bottom bars' and 'extends under opaque bars' to remove the black background during animation.
Modified Setomidor's answer to work on both landscape, portrait, and iPad (the 320 and 480 values only work on iPhone).
Also modified the code to handle changes introduced in iOS 6 with UIDevice orientation change and ensure that it works properly even when the device is lying on its back.
Swift and modified version of @Saurabh code
Method
To show
To hide
in iOS8 it is enough to just set the
hidden
property of thetabBar
Like in Swift you can
I do this in my
didFinishLaunchingWithOptions
in theappdelegate
and it works fine, I think if I remember correctly in the older iOS versions you also needed to set theframe
of thetabBar
to something outside the screen, otherwise thetabbar
would not show but it will still occupy the space.