1
votes

When I connect a push segue using storyboard, from a view controller to a navigation controller, the app crashes when I try to navigate there and error console shows that: 'Push segues can only be used when the source controller is managed by an instance of UINavigationController.'

How do I segue between these two controllers (not using modal).

And the navigation controller I want to segue to is managed by a tab bar controller.

1
The controller you're doing the push from needs to be embedded in a navigation controller. You normally wouldn't do a push to another navigation controller (that would give you two navigation bars). You should rethink your design.rdelmar

1 Answers

0
votes

Okay there are a few things wrong here. Lets start with the error you're getting.

The source controller appears to not have a UINavigationController associated with it. In your storyboard I would click the source view controller and then click the "Editor" menu > "Embed In" > "Navigation Controller". This will make sure that the source controller is now managed by a navigation controller.

After you do this though, you will probably still get a crash or an error of somekind. You are not allowed to push a UINavigationController onto an existing navigation controller stack.

I would take a step back and look at what you are really trying to accomplish here. If you simply want the tab bar to go away then you can check off "Hides bottom bar on push" and then when you push the view controller, it will look as if you pushed a whole new navigation controller.

Otherwise I would question why you are trying to do a push and not a modal. When presenting a new navigation stack it is common practice to present the stack as a modal. Personally it just feels wrong to me to try and present a new stack within an existing stack.