Chapter 5. Building Multiscreen Apps

In this chapter, you will learn how to manage multiple screens inside one app. You will also learn how to make a scrolling list of items. Most apps have multiple screens and at least one scrolling list. This chapter will build on your knowledge base and bring you closer to releasing an app to the App Store.

View Controllers

View controllers are the logic portion of the Model-View-Controller, or MVC, paradigm. See Chapter 1 for a quick review of MVC. It won’t surprise you to learn that a view controller is a controller that controls the view. Don’t overthink it. The view displays information and receives input from the user, but it does not make decisions. Those decisions are made inside the view controller.

UIViewController

Apple highly encourages the MVC approach to development. They recommend it so much that they created their own controller called the UIViewController. UIViewController is part of UIKit. UIKit is a set of classes provided to create interface elements. You will see the prefix UI before any class that is part of UIKit.

UIViewController has been configured to handle much of the heavy lifting for you. It comes with a view property out of the box. The view property is connected to a view file, in most cases, a storyboard file.

UIViewController also has prewritten methods ready for you. Common events like the view loading on the screen or the view disappearing from the screen are already written for you. These methods can be filled with ...

Get Introducing iOS 8 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.