Reputation: 7825
What I'm trying to do
If started creating my App. I've got a NavigationController
as my rootViewController
. When the app is started it will open my LoginViewController
. In there I do the Login-Procedure
, if everything is fine. I'll start my ECSlidingViewController
. Which has a Menu (UITableView
) and a MainView (UITableView
).
Until here everything is working fine. I can swipe and it show's my menu. Now the problem is starting. When I press a menu-item it perfectly starts my new ViewController and show's the content. But there it still show's the same NavigationBar
- like in the ECSlidingViewController
. So I got no possibility to tell the user what he is looking at, also I need to show him sometimes new options in the NavigationBar
.
Question
How can I fix this problem? I'd always like to show the NavigationBar
of the specific ViewController I'm actually using. If you guy's have some Codesnippets or a good Idea how to handle this problem. Please leave a comment bellow.
If you need codesnippets or something else, tell me I'll upload it! Thank you in advance!
Code
This is how I start my ECSlidingMenu:
[self performSegueWithIdentifier:@"loginPush" sender:self.view];
This is how I'll start a new ViewController:
UIViewController *newTopViewController = [self.storyboard instantiateViewControllerWithIdentifier:identifier];
Pictures*
Upvotes: 3
Views: 2240
Reputation: 119031
You want to change your structure so that the ECSlidingViewViewController
is the root view controller. This can either be from the start of the app or you can switch the root after login. The top view controller of the sliding controller should then be a navigation controller and you should set the root and push other view controllers into that navigation controller.
What you currently have breaks the link between the view controllers and the navigation controller because only the sliding view controller is pushed into the stack and its title (nothing about its navigationItem
ever changes).
Probably the easiest solution would be to change the initial view controller in the storyboard (to the sliding view controller). In this case the login view would be presented as the root view of the navigation controller (which would be the top view). Then, after login you push the next view controller and then (after the animation completes) remove the login view controller from the nav stack.
Upvotes: 5