Reputation: 139
I'm using UINavigationController
and UITabbar
like this.
From image you can see diagram, I want to hide tabbarcontroller when I tap from image "6" to image "2", very difficult for me.
I tried
self.tabBarController.hidesBottomBarWhenPushed = YES;
but uitabbar still display when it return image "2"
How to do this?
Upvotes: 1
Views: 995
Reputation: 5156
The storyboard has a loop, it can't work that way. I suggest you take the login screen out of the flow and instantiate it in code. So it can be used from anywhere easily.
First disconnect all segues then embed it in a navigation controller. Give the navigation controller an identifier then use:
[storyboard instantiateViewControllerWithIdentifier:@"MyViewController"];
Then present it modally which will cover the bottom bar.
Upvotes: 0
Reputation: 535108
The diagram (storyboard) is a worry. Do you really mean to do what it says? There's a circle; that can't be right, surely.
Remember, when you use a segue, you are a creating a new instance of this view controller. So you are creating 2, then 3, then 4, then 5, then 6, and then another 2 on top of that in a potentially infinite loop of view controllers piling up.
Surely you want to do when you get to 6 is to unwind all the way back to 2. You want to remove 6, remove 5, remove 4, remove 3, leaving you back at 2.
Or perhaps you want a different instance of 2, to show on top of 6, but then it should be different, not the same one coming back from 6 in a loop. It is fine to have more than one instance of the same view controller in your storyboard, and they can be configured differently.
Upvotes: 1
Reputation: 5812
The UIViewController you are pushing, should have this property set.
Here's an example:
MyAppViewController *controller = [[MyAppViewController alloc] init];
controller.hidesBottomBarWhenPushed = YES;
you are pushing the viewController, so this using this property is applicable to the viewController that is being pushed on to the navigation stack.
remember: hidesBottomBarWhenPushed works only when the view controller is pushed, and wont work as expected when presented modally
Upvotes: 0