Aloysius
Aloysius

Reputation: 107

Push Segue triggers a Modal Segue that leads to VC with no navigation bar

My structure is:

ViewController A [-> (modal)] Navigation Controller -> ViewController B [-> (push)] ViewController C

In other words: VC A has a button you push to do a modal segue to VC B (which happens to be embedded in a Navigation Controller).

Then in VC B, you click on a table view cell and this triggers a push segue to VC C. All segues were made on the storyboard and identifiers were appropriately named.

The Issue is: When you click on the table view cell that transitions from VC B to VC C, the transition does correctly go to VC C, but it animates like a modal segue and VC C does not have a navigation bar (even when I specifically set navigationController?.isNavigationBarHidden = false). Thus, there is no back button.

For debugging purposes, I embedded VC A in a nav controller and had a button from there segue to a new VC with the push segue and the same thing happened (that thing being that the transition did not spawn the nav bar). Any ideas to solve this issue?

EDIT: Basic idea of the VC setup. Note that segue from VC A to VC B is done in code.

VC Setup

Upvotes: 1

Views: 380

Answers (2)

seyha
seyha

Reputation: 554

In VC A you should present navigation controller of VC B. And then in VC B (not its navigation controller) you should connect segue to VC C directly no need to embed navigation controller for VC C. you will get back button after you connected.

Upvotes: 0

ACerts
ACerts

Reputation: 308

To fix this you need to connect the modal segue from VC A to VC B’s Navigation Controller.

Upvotes: 2

Related Questions