Reputation: 1608
My goal is simply to remove my app's tab bar whenever the user navigates to a specific screen, so that I have more space available.
Currently, my storyboard looks like this:
Whenever the user clicks a button they will be taken to another screen, which is the last screen in the sequence. My goal is to simply remove the tab bar, but keep the navigation.
If I use a show detail
segue, then it will remove the tab bar but also the navigation, which is something I don't want.
This is the final screen (but it still has tab bar):
Upvotes: 3
Views: 2004
Reputation: 27438
You can write prepareforsegue
like below,
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
segue.destinationViewController.hidesBottomBarWhenPushed = YES;
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
Swift:
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
segue.destinationViewController.hidesBottomBarWhenPushed = true
}
So in destination view controller tabbar will not shown.
According to your question you can implement in FirstTableViewcontroller
and tabbar will not visible in TaretViewController
.
Hope this will help :)
Upvotes: 1
Reputation: 4849
You can even set the property hidesBottomBarWhenPushed
equal to true
on your DestinationViewController
. You can do it in your prepareForSegue
method override.
if let vc = segue.destinationViewController as? YOURVIEWCONTROLLER {
vc.hidesBottomBarWhenPushed = true
}
In this way, if the ViewController should need the bottom bar in other cases, it'll be shown
Upvotes: 4
Reputation: 1093
All you need it to set hidesBottomBarWhenPushed = true
on the view controller you want it to be hidden on. insert in viewDidLoad()
You can also set this in the storyboard of the children view controllers
Upvotes: 6
Reputation: 2328
hide in viewWillDisappear
self.tabBarController.tabBar.hidden = YES;
Upvotes: 0