playing simulator for multiple viewocontrollers

Hi I have multiple viewcontroller screens for my app (so diffrent screens for each stage) and when I click on play for the simulator it only plays the first one



how can i do it so when i play the simulator it plays through all my screens?


thanks

Accepted Reply

The simulator opens on the initial view (the one where there is an inbound arrow drawn in the storyboard).


Going to other views is the role of the app.


As an example on how to do it:

- in the first view, insert a button (in Interface builder) by dragging it inside the view ; call it "Go To View 2"

- control-drag from this button to another view

- you will see a menu to define segue: select show.

- Run the app and click on the button: you will go to second view.


Now, you are locked in this view, impossible to return to the initial view ?

Of course it is.

in the initial view, add the following code:

@IBAction func unwindToStartViewController(_ sender: UIStoryboardSegue) {
       // It is empty, no problem
    }

- create a button (in Interface builder) in this second view ; call it 'Return"

- in this second view, control drag from this button to the exit button at the very top right of the viewController of this second wind

- in the pop up that appears, select : unwindToStartViewController


Run the app

click "Go To View 2" to go to second view

click "Return" to go back to initial view.

Replies

The simulator opens on the initial view (the one where there is an inbound arrow drawn in the storyboard).


Going to other views is the role of the app.


As an example on how to do it:

- in the first view, insert a button (in Interface builder) by dragging it inside the view ; call it "Go To View 2"

- control-drag from this button to another view

- you will see a menu to define segue: select show.

- Run the app and click on the button: you will go to second view.


Now, you are locked in this view, impossible to return to the initial view ?

Of course it is.

in the initial view, add the following code:

@IBAction func unwindToStartViewController(_ sender: UIStoryboardSegue) {
       // It is empty, no problem
    }

- create a button (in Interface builder) in this second view ; call it 'Return"

- in this second view, control drag from this button to the exit button at the very top right of the viewController of this second wind

- in the pop up that appears, select : unwindToStartViewController


Run the app

click "Go To View 2" to go to second view

click "Return" to go back to initial view.

Hi Claude31 you are really helpful!!!


Actually as you can probably tell I am really new to all of this, and i only started a few days ago


I have pretty much built all the screens in view controller but so far have not added any code because I do not know how to code yet im still learning the basics of xcode


once I learn more coding I will get onto that but im making faster progress than i thought already made 10 screens out of the 35 required!!


thanks again !!

35?


Are you sure you need to do that many? What type app are you working on?


See https://developer.apple.com/ios/human-interface-guidelines/app-architecture/navigation/