Reputation: 256
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?
Upvotes: 8
Views: 9925
Reputation: 16052
Using Swift
:
let viewController = CustomViewController()
viewController.hidesBottomBarWhenPushed = true
self.navigationController?.pushViewController(viewController, animated: true)
Upvotes: 1
Reputation: 8947
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 :)
Upvotes: 23