Question

I want to implement something using Storyboards, but I don't know the best way to accomplish it. I don't want to use a Navigation Controller, since I don't want the navigation bar at the top. I just want the ability to switch from one view controller to the next.

I have a Main Menu view controller, which will segue into other views, and those views might segue to other views... Now, lets say that the last view in the chain has a "Return To Menu" button: should I just segue from that button to the Menu view controller? Or should I somehow dismiss all of the previous view controllers?

I don't need iOS to hold a copy of the Main Menu view controller after the user taps out of it, but I can't seem to find a way to just load a new view controller and present it, instead of having a parent view display it "modally".

  • Would it cause a memory leak if I just create a loop of modal segues?

(for example: Main Menu --> VC1 --> VC2 --> Main Menu --> VC3 --> VC4 --> Main Menu...)

Any help will be much appreciated. Thanks!

Was it helpful?

Solution

Each segue creates a new instance of the destination view controller, so having a segue back to the main menu is not a good idea.

You would be better off dismissing the presented view controller(s), but note that it is possible to use a navigation controller without showing the navigation bar - the navigation controller has a property, navigationBarHidden, which you can set to hide this.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top