Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set programmatically "Hides bottom bar on push"?

Tags:

xcode

iphone

ios5

I am building a view programmatically from a tableview which has a bottom tab bar. I would like this bottom bar to disappear when a table cell is selected. I can do that using:

self.tabBarController.tabBar.hidden = YES;

but the size of the view remains as if the tabbar was still there. I see that if the view is built on the storyboard and by setting the checkmark "Hides bottom bar on push", the view resizes to occupy the space left free by the tabbar. How can I do that programmatically?

like image 421
Malagasy Desi Avatar asked May 20 '12 13:05

Malagasy Desi


1 Answers

self.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:self.anotherViewController animated:animated];

and for a specific view controller which your pushing. use this code

    TheViewController* theController = [[TheViewController alloc] initWithNibName:@"TheViewController" bundle:nil];
    theController.hidesBottomBarWhenPushed = YES;
    [self.navigationController pushViewController:theController animated:YES];
    [theController release];

now the tabbar will be hidden and shown autometically. enjoy the time :)

like image 110
Saad Avatar answered Nov 07 '22 23:11

Saad