Reputation: 4934
I have a navigation controller which should have a different root depending on the state of my App.
How can i model this within Interface Builder? I've dragged out a UINavigationController
to my Storyboard. Now I need to make the connections to the two view controllers.
Sadly I can only set one as root view controller. Do i need to subclass the Navigation Controller and based on the state reset the root view controller?
What is the best practise for this kind of problem? It would be nice to visualize this relationship within Interface Builder.
Thanks in advance for any help.
Upvotes: 3
Views: 2398
Reputation: 2751
As it is the rootViewController you want to change conditionally, you could instead have two different navigationControllers, each with the one of the two different viewControllers as its rootViewController.
You could then present the appropriate navigationController based on your condition.
Upvotes: 4
Reputation: 4017
Have two segues (one to viewcontrollerA and the other to viewcontrollerB). The your Navigation Controller would determine the App state and call performSegue to move the user to the correct view controller.
Upvotes: 1