views:

3734

answers:

5

I have a UITabBar in the detail view of my navigation based application. I am storing text and images in a tableview and would like the user to be able to tap on a cell to hide the navigation controller and the tabbar for full screen viewing of the content.

I found this code for hiding the top bars, but it does not seem as easy to hide the tabbar.

[[UIApplication sharedApplication] setStatusBarHidden:YES animated:YES];
 [self.navigationController setNavigationBarHidden:YES animated:YES];

Does anyone know how to do this?

This code does not work to hide the tabBar once the view is already loaded.

  yourTabViewController.hidesBottomBarWhenPushed = YES;
+2  A: 

This is the code I found. Seems to only work when the view is loaded though, so it can't be used to hide the tabbar once it has already appeared. I'm still struggling to make this work. Please help!!!

    self.tabBarController.tabBar.hidden = YES;
Jonah
+1  A: 

The best workaround I have found is to change the view size so that it covers the tabbar. Here's my code for hiding the statusBar, navBar, and tabBar when a row is selected:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];

if (appDelegate.navigationController.navigationBar.hidden == NO)
{
    [[UIApplication sharedApplication] setStatusBarHidden:YES animated:YES];
    [appDelegate.navigationController setNavigationBarHidden:YES animated:YES];

    [UIView beginAnimations:@"HideTabbar" context:nil];
    [UIView setAnimationDuration:.2];
    self.view.frame = CGRectMake(0,0,320,480);
    [UIView commitAnimations];
}
if (appDelegate.navigationController.navigationBar.hidden == YES)
{
    [[UIApplication sharedApplication] setStatusBarHidden:NO animated:YES];
    [appDelegate.navigationController setNavigationBarHidden:NO animated:YES];

    [UIView beginAnimations:@"ShowTabbar" context:nil];
    [UIView setAnimationDuration:.2];
    self.view.frame = CGRectMake(0,0,320,368);
    [UIView commitAnimations];
}   
}
Jonah
A: 

Hi. I am using a TabbarController. I´d like to resize the view like you described above. But it´s not working. Why I am not able to change the resize the view. Are you sure this is working?? I tried so many times in serveral ways. But no success. Do you have an idea whats wrong? THX for your support. PIT

Peter Mertzlin
Can you post some code? I'm not sure why it wouldn't be working for you.
Jonah
A: 

In order to adjust the size of your window, you first need to select the option of NONE in the status bar field, under your Attributes tab, of your Inspector window. Interface Builder will then let you change the size of your window.

Chase Williams
A: 

i have an app with 2 view and botton tab bar.

in the first view there is the button that play video, but when video start, the tab bar is bottom over the video !!!!

your code can hide the tab bar only when video play? and firstviewcontroller come back to original state when video finish?

where i need to insert? in appdelegate.m? or firstviewcontroller.m?

Regards

luca
I could not make this code work once the view was loaded. You may want to push to a new view when you load the video using hidesBottomBarWhenPushed or some similar method.
Jonah