Swapping Screens

To create an app with multiple screens, begin by creating multiple view controllers. Each should have its own nib file. If your app needs more than two screens, the main controller object is designated the parent controller.

There are three schemes for swapping screens:

bullet_2c.tif Modal screens. These appear temporarily to display optional information such as preferences. When the user has finished with this screen, it disappears and reveals the original view.

bullet_2c.tif Manual screen swaps. You can create as many screens as you need, using whatever logical flow works best for your app. Non-modal screens suggest a permanent change in the state of the app or in the information it displays.

bullet_2c.tif Storyboards. You can use these to sketch out a logical flow, with optional transition animations.

Adding a modal screen

Follow these steps:

1. Create a new Single View Application project. Save it as ModalScreenSwapping.

2. Add some distinctive content to the main nib file. The exact content doesn’t matter.

3. Use the Add File… option to add a new subclass of UIViewController to your project. Check the option that creates a nib file. Save the file as SecondViewController.

4. Add some different distinctive ...

Get iOS App Development Portable Genius now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.