Chapter 5. Basic view controllers

 

This chapter covers

  • Understanding the importance of controllers
  • Programming bare view controllers
  • Utilizing table view controllers

So far in the last two chapters we haven’t strayed far from the most fundamental building block of the SDK: the view, whether a UILabel, a UIWebView, or a UIImage-View. Ultimately, the view is only part of the story. As we mentioned when we looked at iOS, views are usually connected to view controllers, which manage events and otherwise take the controller role in the MVC model. We’re now ready to begin a three-part exploration of what that all means.

In this chapter, we look at basic view controllers that manage a single page of text. With that basis, we can examine events and actions in chapter 6, correctly integrating them into the MVC model. Finally, in chapter 7, we’ll return to the topic of view controllers to look at advanced classes that can be used to connect several pages of text.

Over the course of our two view controller chapters (5 and 7), we’ll offer code samples that are a bit more skeletal than usual. That’s because we want to provide you with the fundamental, reusable code that you’ll need to use the controllers on your own. Consider chapters 5 and 7 more of a reference—although a critical one. You’ll make real-world use of the controllers in the rest of this book, including when we look at events and actions in chapter 6. Right now, though, let’s examine the available view controllers.

5.1. The view controller family

5.2. The standard view controller

5.3. The table view controller

5.4. Summary