Hiding tabBar showing black bar in Ios7 - ios

I am using this code to hide the TabBar:
self.tabBarController.tabBar.hidden=YES;
I am hiding tabBarController in my project.but it showing black bar in bottom of the view in Ios7.When i go back to the same view it is looking good.any help will be appreciated.

NOTE: It is solution for iOS6 and 7 only.
In iOS 7 to extend clickable area and hide black bar on place of hidden UITabBar you should enable 'Extend Edges - Under Opaque Bars' option for you UIViewController.
Or you can set this property programmatically:
[self setExtendedLayoutIncludesOpaqueBars:YES]
Here is example of code that hide or move TabBar for iOS 6/7:
UITabBarController *bar = [self tabBarController];
if ([self respondsToSelector:#selector(setExtendedLayoutIncludesOpaqueBars:)]) {
//iOS 7 - hide by property
NSLog(#"iOS 7");
[self setExtendedLayoutIncludesOpaqueBars:YES];
bar.tabBar.hidden = YES;
} else {
//iOS 6 - move TabBar off screen
NSLog(#"iOS 6");
CGRect screenRect = [[UIScreen mainScreen] bounds];
float height = screenRect.size.height;
[self moveTabBarToPosition:height];
}
//Moving the tab bar and its subviews offscreen so that top is at position y
-(void)moveTabBarToPosition:(int)y {
self.tabBarController.tabBar.frame = CGRectMake(self.tabBarController.tabBar.frame.origin.x, y, self.tabBarController.tabBar.frame.size.width, self.tabBarController.tabBar.frame.size.height);
for(UIView *view in self.tabBarController.view.subviews) {
if ([view isKindOfClass:[UITabBar class]]) {
[view setFrame:CGRectMake(view.frame.origin.x, y, view.frame.size.width, view.frame.size.height)];
} else {
[view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, y)];
view.backgroundColor = [UIColor blackColor];
}
}
}
Function to moving the Tab Bar offscreen got from this post.

Next code works for me
- (void)showTabBar {
[self.tabBar setTranslucent:NO];
[self.tabBar setHidden:NO];
}
- (void)hideTabBar {
[self.tabBar setTranslucent:YES];
[self.tabBar setHidden:YES];
}

Try this:
- (BOOL)hidesBottomBarWhenPushed {
return YES;
}

I had some trouble while using a UINavigationController:
Here's my solution that works for iOS 7 AND UINavigationControllers:
HeaderFile
#interface UITabBarController (HideTabBar)
- (void)setHideTabBar:(BOOL)hide animated:(BOOL)animated;
#end
Implementation
#import "UITabBarController+HideTabBar.h"
#implementation UITabBarController (HideTabBar)
- (void)setHideTabBar:(BOOL)hide animated:(BOOL)animated {
UIViewController *selectedViewController = self.selectedViewController;
/**
* If the selectedViewController is a UINavigationController, get the visibleViewController.
* - setEdgesForExtendedLayout won't work with the UINavigationBarController itself.
* - setExtendedLayoutIncludesOpaqueBars won't work with the UINavigationBarController itself.
*/
if ([selectedViewController isKindOfClass:[UINavigationController class]])
selectedViewController = ((UINavigationController *)selectedViewController).visibleViewController;
__weak __typeof(self) weakSelf = self;
void (^animations)(void) = ^{
selectedViewController.edgesForExtendedLayout = UIRectEdgeAll;
[selectedViewController setExtendedLayoutIncludesOpaqueBars:hide];
weakSelf.tabBar.hidden = hide;
/**
* Just in case we have a navigationController, call layoutSubviews in order to resize the selectedViewController
*/
[selectedViewController.navigationController.view layoutSubviews];
};
[UIView animateWithDuration:animated ? UINavigationControllerHideShowBarDuration : 0 animations:animations];
}
#end
Thanks to Vadim Trulyaev for pointing out the Extend Edges - Under Opaque Bars flag!

One line Swift 3 answer.
Put the following in your UIViewController subclass:
override var hidesBottomBarWhenPushed: Bool { get { return true } set { self.hidesBottomBarWhenPushed = newValue }}

Set true the property hidesBottomBarWhenPushed in the controller to hide.
For hide, all your controllers put into prepare for segue
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
segue.destination.hidesBottomBarWhenPushed = true
}

To showTabbar:
- (void)showTabBar:(UITabBarController *) tabbarcontroller
{
//[UIView beginAnimations:nil context:NULL];
//[UIView setAnimationDuration:0.5];
for(UIView *view in tabbarcontroller.view.subviews)
{
if([view isKindOfClass:[UITabBar class]])
{
[view setFrame:CGRectMake(view.frame.origin.x, 521, view.frame.size.width, view.frame.size.height)];
}
else
{
[view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, 521)];
}
}
// [UIView commitAnimations];
}
To hide Tabbar:
- (void)hideTabBar:(UITabBarController *) tabbarcontroller
{
//[UIView beginAnimations:nil context:NULL];
//[UIView setAnimationDuration:0.5];
for(UIView *view in tabbarcontroller.view.subviews)
{
if([view isKindOfClass:[UITabBar class]])
{
[view setFrame:CGRectMake(view.frame.origin.x, 568, view.frame.size.width, view.frame.size.height)];
}
else
{
[view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, 568)];
}
}
//[UIView commitAnimations];
}

I spent a long time battling this, trying to place a responsive button at the bottom of table view. I am not using auto-layout. I found two main differences between iOS 6 and 7:
On iOS7, when the tab bar is animated out, the view of the root view controller does not extend into the area where the tab bar was; it needs to be resized.
On iOS7, only the view of type UITabBar needs to be animated off and on the screen.
A further issue with point 1 is that if, in iOS7, you extend a child view of your visible view controllers main view over the space left behind by the tab view, it won't be interactable unless the main view is extended as well. With that in mind, I used the following code:
Hide tab bar (reverse the math so show it):
[UIView animateWithDuration:kHideTabBarAnimationDuration animations:^{
for(UIView *view in self.tabBarController.view.subviews)
{
if([view isKindOfClass:[UITabBar class]])
{
[view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y + view.frame.size.height, view.frame.size.width, view.frame.size.height)];
}
else
{
if (![MYDeviceUtility systemVersionGreaterThanOrEqualTo:#"7.0"])
{
[view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, view.frame.size.height + self.tabBarController.tabBar.frame.size.height)];
}
}
}
} completion:nil];
Adjust the main view when hiding tab bar:
// Expand view into the tab bar space
if ([MYDeviceUtility systemVersionGreaterThanOrEqualTo:#"7.0"])
{
CGRect frame = self.view.frame;
self.view.frame = CGRectMake(frame.origin.x,
frame.origin.y,
frame.size.width,
frame.size.height + tabBarHeight);
}
Adjust the main view when revealing tab bar:
[UIView animateWithDuration:kHideTabBarAnimationDuration delay:0.0f options:UIViewAnimationOptionCurveEaseIn animations:^{
// Create space for the tab bar
if ([MYDeviceUtility systemVersionGreaterThanOrEqualTo:#"7.0"])
{
CGRect frame = self.view.frame;
self.view.frame = CGRectMake(frame.origin.x,
frame.origin.y,
frame.size.width,
frame.size.height - tabBarHeight);
}
} completion:nil];
Note that I don't animate the main view expansion when hiding the tab bar, this looks natural since the expansion happens behind the tab bar.
Also note
In iOS 7, if you rotate from portrait to landscape while the tab bar is hidden, the black box reappears. I solved this by animating the tab bar back onto the screen before the rotation animation (which was good enough for what I'm working on).

Based on solution of #Vadim Trulyaev, i created a simple usage:
UITabBarController+HideTabBar.h
#interface UITabBarController (Additions)
- (void)setTabBarHidden:(BOOL)hidden myClass:(UIViewController *)myClass;
#end
UITabBarController+HideTabBar.m
#import "UITabBarController+HideTabBar.h"
#implementation UITabBarController (HideTabBar)
- (void)setTabBarHidden:(BOOL)hidden myClass:(UIViewController *)myClass{
if ([myClass respondsToSelector:#selector(setExtendedLayoutIncludesOpaqueBars:)]) {
//iOS 7 - hide by property
NSLog(#"iOS 7");
[myClass setExtendedLayoutIncludesOpaqueBars:hidden];
self.tabBar.hidden = hidden;
} else {
//iOS 6 - move TabBar off screen
NSLog(#"iOS 6");
CGRect screenRect = [[UIScreen mainScreen] bounds];
float height = screenRect.size.height;
if(hidden){
[self moveTabBarToPosition:height];
}else{
[self moveTabBarToPosition:height - self.tabBar.frame.size.height];
}
}
}
//Moving the tab bar and its subviews offscreen so that top is at position y
-(void)moveTabBarToPosition:(int)y {
self.tabBar.frame = CGRectMake(self.tabBarController.tabBar.frame.origin.x, y, self.tabBar.frame.size.width, self.tabBar.frame.size.height);
for(UIView *view in self.view.subviews) {
if ([view isKindOfClass:[UITabBar class]]) {
[view setFrame:CGRectMake(view.frame.origin.x, y, view.frame.size.width, view.frame.size.height)];
} else {
NSLog(#"%f",view.frame.size.height);
[view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, y)];
NSLog(#"%f",view.frame.size.height);
view.backgroundColor = [UIColor blackColor];
}
}
}
#end
How to use:
[[self tabBarController] setTabBarHidden:NO myClass:self];
BUT, in iOS6 i have some issue, when i go first time to ViewController1 where the tabbar is hidden everthing works fine, but if i go to a ViewController2 that show the tab bar and back to ViewController1 that the tab bar must be hidden, the black space show up. Anyone can help me?!
Thanks!

In addition to the other excellent suggestions the following suggestion might help someone out. Try setting your tabbar to hidden in awakeFromNib instead of later in the lifecycle. I found that the hidden tabbar was flashing black on segue and this fixed it for me.
- (void)awakeFromNib
{
[super awakeFromNib];
self.tabBarController.tabBar.hidden = YES;
}

Related

hiding a non-translucent uitabbar [duplicate]

I have a question about iOS's UITabBarController's tab bar.
I'm using a UITabBarController to display a few views, but as I want the views to be displayed with as large a screen as possible. Is it possible to hide the tab bar so that it normally doesn't show, until the user touches the screen, then the tab bar will (with animation) show up at the bottom. Then, after a few seconds, if nothing is done, then the tab bar will again go away, so that the view going back to be full screen again?
This is how you show it
- (void)showTabBar:(UITabBarController *)tabbarcontroller
{
tabbarcontroller.tabBar.hidden = NO;
[UIView animateWithDuration:kAnimationInterval animations:^{
for (UIView *view in tabbarcontroller.view.subviews) {
if ([view isKindOfClass:[UITabBar class]]) {
[view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y-49.f, view.frame.size.width, view.frame.size.height)];
}
else {
[view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, view.frame.size.height-49.f)];
}
}
} completion:^(BOOL finished) {
//do smth after animation finishes
}];
}
... and this is how you hide it
- (void)hideTabBar:(UITabBarController *)tabbarcontroller
{
[UIView animateWithDuration:kAnimationInterval animations:^{
for (UIView *view in tabbarcontroller.view.subviews) {
if ([view isKindOfClass:[UITabBar class]]) {
[view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y+49.f, view.frame.size.width, view.frame.size.height)];
}
else {
[view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, view.frame.size.height+49.f)];
}
}
} completion:^(BOOL finished) {
//do smth after animation finishes
tabbarcontroller.tabBar.hidden = YES;
}];
}
With the accepted answer, on iOS 7 when you hide the tab bar and you show it again the size is wrong. This code gives a better result:
- (void) toggleTabBar: (UITabBar *)tabBar view: (UIView*) view {
tabBar.hidden = NO;
[UIView animateWithDuration:0.5 animations:^{
if (hiddenTabBar) {
tabBar.center = CGPointMake(tabBar.center.x, self.view.window.bounds.size.height-tabBar.bounds.size.height/2);
}
else {
tabBar.center = CGPointMake(tabBar.center.x, self.view.window.bounds.size.height+tabBar.bounds.size.height);
}
} completion:^(BOOL finished) {
hiddenTabBar = !hiddenTabBar;
tabBar.hidden = hiddenTabBar;
}];
}
Don't think that will work on Apple's UIGuidelines. The views you're using are drawn above the the tab bar, so if you fade it away, nothing will be there.
You could possibly make a small view with buttons in place of the tab bar that does what you want.

Hide TabBar and show NavigationController toolbar on button click

I have the following view hierarchy:
Tab Bar Controller -> Navigation Controller -> Custom View Controller
In my Custom View I want the TabBar to disappear and show a toolbar instead. Much like in iOS7 native photos app when pressing 'select'.
I tried different solutions I found of SO but managed to get either:
TabBar hidden and Toolbar shown with black gap
TabBar hidden and Toolbar hidden
TabBar hidden Toolbar shown with gap from bottom. However, Custom view content reaches the bottom of the screen (under the toolbar and in the same place the tab bar used to be)
The difference from other solutions I found is that I need this to happen on click and not on push.
Some of the things I tried:
// #1
[self.navigationController.toolbar setHidden:!isSelecting];
[self.tabBarController.tabBar setHidden:isSelecting];
// #2
self.hidesBottomBarWhenPushed = YES;
// #3
#1 & #2 variants # different controller along the path
Eventually, after playing with the settings I managed to make it work. I'm not sure why it works now and didn't work before so I'd appreciate your comments.
Storyboard:
Mark as checked "Hide Bottom Bar on Push" for the Custom View Controller
Mark as checked "Show Toolbar" for the Navigation Controller
Code:
On button click hide/unhide tabBar: [self.tabBarController.tabBar setHidden:state]
This almost works. It does hide/unhide the tabBar when pressing the button but the only problem is that the tabBar is initially hidden when switching tabs. I had to do some extra effort to have it visible.
Set UITabBarControllerDelegate to unhide tabBar when switching tabs. I did it in a custom SUSourceTabController:
- (void)viewDidLoad
{
[super viewDidLoad];
self.delegate = self;
}
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController: (UIViewController *)viewController
{
[self.tabBar setHidden:NO];
}
We also need to unhide it for the first tab view in the Custom View Controller code. Using setHidden:NO in any other place in the code didn't work.
- (void)viewDidLoad
{
[super viewDidLoad];
[self.tabBarController.tabBar setHidden:NO];
}
Check this category from this question's answer.
UITabBarController+HideTabbar.h
#import <UIKit/UIKit.h>
#interface UITabBarController (HideTabbar)
- (void)setHidden:(BOOL)hidden animated:(BOOL)animated;
#end
UITabBarController+HideTabbar.m
#import "UITabBarController+HideTabbar.h"
#define kAnimationDuration .3
#implementation UITabBarController (HideTabbar)
- (void)setHidden:(BOOL)hidden animated:(BOOL)animated
{
CGRect screenRect = [[UIScreen mainScreen] bounds];
float fHeight = screenRect.size.height;
if (UIDeviceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation)) {
fHeight = screenRect.size.width;
}
if (!hidden) {
fHeight -= self.tabBar.frame.size.height;
}
CGFloat animationDuration = animated ? kAnimationDuration : 0.f;
[UIView animateWithDuration:animationDuration animations:^{
for (UIView *view in self.view.subviews){
if ([view isKindOfClass:[UITabBar class]]) {
[view setFrame:CGRectMake(view.frame.origin.x, fHeight, view.frame.size.width, view.frame.size.height)];
}
else {
if (hidden) {
[view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, fHeight)];
}
}
}
} completion:^(BOOL finished){
if (!hidden){
[UIView animateWithDuration:animationDuration animations:^{
for(UIView *view in self.view.subviews) {
if (![view isKindOfClass:[UITabBar class]]) {
[view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, fHeight)];
}
}
}];
}
}];
}
#end

Unable to tap on UITabBar Frame area

In one of the view controller UITabBar has been set hidden and in the same place one CustomView with UITextField is added, But the entire CustomView is not taking any action.
If custom view is placed above the UITabBar it works fine. But I want to hide the Tab Bar in and place CustomView in the same frame.
I am using the below code to hide the Tab Bar
[self.tabBarController.tabBar setHidden:YES];
TaB Bar is added like this
[self.window addSubview:self.tabBarController.view];
Hiding the UITabBar does not still allow view below it to work. You will have to manually move the UITabBar when you want to hide and manually bring it back when you want to unhide if you want this functionality. The following code would work:
- (void)hideTabBar:(UITabBarController *) tabbarcontroller
{
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
for(UIView *view in tabbarcontroller.view.subviews)
{
if([view isKindOfClass:[UITabBar class]])
{
[view setFrame:CGRectMake(view.frame.origin.x, 480, view.frame.size.width, view.frame.size.height)];
}
else
{
[view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, 480)];
}
}
[UIView commitAnimations];
}
If you want to move a particular tab bar button instead of the complete controller, you may have to do a little tweaking in the code.
Another option is to use hideBottomBarWhenPushed option like this
self.hidesBottomBarWhenPushed = true;
There is a property in UIViewController exactly for this reason - hidesBottomBarWhenPushed;
If you use storyboard then you can set this in view controller's attributes inspector in the storyboard - this is the best solution IMHO.
Like this:
If you don't use storyboard then you can set this property to YES in in viewDidLoad or in 'init' of the view controller that should hide the tab bar.
Something like this:
- (void)viewDidLoad {
[super viewDidLoad];
self.hidesBottomBarWhenPushed = YES;
}
I use the following code resize views when hiding/unhiding tabBar :
- (void)hideTabBar{
for (UIView *view in self.tabBarController.view.subviews) {
if ([view isKindOfClass:[UITabBar class]]) {
view.frame = CGRectMake(view.frame.origin.x,
[UIScreen mainScreen].bounds.size.height,
view.frame.size.width,
view.frame.size.height);
} else {
view.frame = CGRectMake(view.frame.origin.x,
view.frame.origin.y,
view.frame.size.width,
[UIScreen mainScreen].bounds.size.height);
}
}
}
- (void) showTabBar {
for (UIView *view in self.tabBarController.view.subviews) {
if ([view isKindOfClass:[UITabBar class]]) {
view.frame = CGRectMake(view.frame.origin.x,
[UIScreen mainScreen].bounds.size.height - 49,
view.frame.size.width,
view.frame.size.height);
} else {
view.frame = CGRectMake(view.frame.origin.x,
view.frame.origin.y,
view.frame.size.width,
[UIScreen mainScreen].bounds.size.height - 49);
}
}
}
Where 49 is the height of the tabBar.

show/hide the tabbar when needed from a view controller

i am new to iOS programming. i really need your help.
i have a login screen that takes me to a map (google API). on clicking any created annotation i want to load a tabbar with 2 views.
i searched and found out that i need to add the tabbar at the starting ie the appdelegate and show/hide the tabbar when needed.
so i made 2 functions to show and hide tabbar as
-(void)Load_tabBar{
[self.navigationController.view removeFromSuperview];
[self.window addSubview:tabBarController.view];
[self.window makeKeyWindow];}
-(void)remove_tabBar{
self.tabBarController.selectedIndex=0;
[self.tabBarController.view removeFromSuperview];
[self.window addSubview:navigationController.view];
[self.window makeKeyWindow];}
it did work when i call the Load_tabBar method and when i click back it calls remove_tabBar method. if i again call Load_tabBar method and back, it crashes giving error
-[UILayoutContainerView window]: message sent to deallocated instance 0x563b0b0
edited: PS : can i add tabbar view to a view controller and then push that view?
thnx
use this self.hidesBottomBarWhenPushed = YES;
This method definitely works. You just need to put it in the method BEFORE you push it, like this:
-actionThatPushTheViewController {
//create the view controller here, do some init.
//then:
theViewControllerToBePushed.hidesBottomBarWhenPushed = YES;
//push it here like this:
[self.navigationController pushViewController:theViewControllerToBePushed animated:YES];
I hope this two methods may help you,
- (void) hideTabBar:(UITabBarController *) tabbarcontroller {
int height = 480;
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3];
for(UIView *view in tabbarcontroller.view.subviews) {
if([view isKindOfClass:[UITabBar class]]) {
[view setFrame:CGRectMake(view.frame.origin.x, height, view.frame.size.width, view.frame.size.height)];
}
else {
[view setFrame:CGRectMake(view.frame.origin.x,view.frame.origin.y, 320, 436)];
}
}
[UIView commitAnimations];
}
- (void) showTabBar:(UITabBarController *) tabbarcontroller {
int height = 480;
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3];
for(UIView *view in tabbarcontroller.view.subviews) {
if([view isKindOfClass:[UITabBar class]]) {
[view setFrame:CGRectMake(view.frame.origin.x, height, view.frame.size.width, view.frame.size.height)];
}
else {
[view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, height)];
}
}
[UIView commitAnimations];
}
Just put this two methods in AppDelegate class and call it where ever required as per you requirement.
if you want to hide it when pushed and show it when popped here is code:
if let viewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "SecondVC") as? SecondVC {
if let navigator = navigationController {
viewController.hidesBottomBarWhenPushed = true
navigator.pushViewController(viewController, animated: true)
}
}

iOS- How to Hide/Show UITabBarController's tab bar with animation?

I have a question about iOS's UITabBarController's tab bar.
I'm using a UITabBarController to display a few views, but as I want the views to be displayed with as large a screen as possible. Is it possible to hide the tab bar so that it normally doesn't show, until the user touches the screen, then the tab bar will (with animation) show up at the bottom. Then, after a few seconds, if nothing is done, then the tab bar will again go away, so that the view going back to be full screen again?
This is how you show it
- (void)showTabBar:(UITabBarController *)tabbarcontroller
{
tabbarcontroller.tabBar.hidden = NO;
[UIView animateWithDuration:kAnimationInterval animations:^{
for (UIView *view in tabbarcontroller.view.subviews) {
if ([view isKindOfClass:[UITabBar class]]) {
[view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y-49.f, view.frame.size.width, view.frame.size.height)];
}
else {
[view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, view.frame.size.height-49.f)];
}
}
} completion:^(BOOL finished) {
//do smth after animation finishes
}];
}
... and this is how you hide it
- (void)hideTabBar:(UITabBarController *)tabbarcontroller
{
[UIView animateWithDuration:kAnimationInterval animations:^{
for (UIView *view in tabbarcontroller.view.subviews) {
if ([view isKindOfClass:[UITabBar class]]) {
[view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y+49.f, view.frame.size.width, view.frame.size.height)];
}
else {
[view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, view.frame.size.height+49.f)];
}
}
} completion:^(BOOL finished) {
//do smth after animation finishes
tabbarcontroller.tabBar.hidden = YES;
}];
}
With the accepted answer, on iOS 7 when you hide the tab bar and you show it again the size is wrong. This code gives a better result:
- (void) toggleTabBar: (UITabBar *)tabBar view: (UIView*) view {
tabBar.hidden = NO;
[UIView animateWithDuration:0.5 animations:^{
if (hiddenTabBar) {
tabBar.center = CGPointMake(tabBar.center.x, self.view.window.bounds.size.height-tabBar.bounds.size.height/2);
}
else {
tabBar.center = CGPointMake(tabBar.center.x, self.view.window.bounds.size.height+tabBar.bounds.size.height);
}
} completion:^(BOOL finished) {
hiddenTabBar = !hiddenTabBar;
tabBar.hidden = hiddenTabBar;
}];
}
Don't think that will work on Apple's UIGuidelines. The views you're using are drawn above the the tab bar, so if you fade it away, nothing will be there.
You could possibly make a small view with buttons in place of the tab bar that does what you want.

Resources