简体   繁体   中英

How do I segue from a UINavigationController to a UIViewController

I have an app where this happens:

First you look at UIViewController which lets you run a timer (for a running sprint across a Soccer field).

So you finish your time, you see the result, and then you can do a few other things. One is that you can look at a list of your previous scores so I segue to a UINavigationController to show those (because if you choose one score, you can drill down and get more information about that sprint).

So I go on Storyboard, I add a button to UIViewController and when user touches it, they segue to the UINavigationController, do their business, and then they want to go back to the score.

But the first screen of UINavigationController doesn't have BACK button (because scene that presented it is not UINavigationController I think) and I can't make one appear in Storyboard. But I don't think that the first screen should be a navigation controller.

Sorry if this is too simple, I just am missing how to make a back button show up on the first look of UINavigationController or if there is some other thing I am missing that is better way to do this all.

Would like to do all this in storyboard if possible, just seems more future-proofs.

Embed your first view controller in a Navigation Controller.

The reason you can't go back to your first view is because you have your second view embedded in a Navigation Controller, so there is not a recognisable way back by using only storyboards; there is no further navigational way back to it as you have gone:

VC1 --> Nav Controller --> VC2 --> etc.

Your navigation controller has no knowledge of VC1 so it needs to look like this:

Nav Controller --> VC1 --> VC2 --> etc.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM