Creating App Screen Navigation in Seconds

Almost any app you are going to build is going to have multiple screens, and you are going to want to navigate back and forth between them seamlessly. Xcode makes the set up nearly instant.

1. Choose your Home View Controller

From a new project, press the left button (of 3) to highlight your View Controller.

2. Embed a Navigation Controller

From the top of your screen, tap Editor > Embed In > Navigation Controller

You just added in a Navigation Controller, which creates a navigation bar (empty and grey) at top of your current View Controller.

3. Create a 2nd View Controller

Open up your object library (Shift + Cmd + L), and drag in a 2nd View Controller.

4. Add in a button to allow for navigation

You need something to actually navigate from your home view controller to the new one. For simplicity, I’m just creating a simple button with the text “Navigate forward!”

The actual Navigation Controller never has anything added to it. You add everything to the controller that is connected to the right of it.

5. Allow button navigation

While holding Ctrl, drag the button over to the 2nd View Controller. Then create an action Segue of Show.

6. Test it out

Open the simulator. You now have easy back and forth navigation.

Now go navigate!

Leave a Comment

Your email address will not be published. Required fields are marked *