Understanding UIViewControllers

iOS development and the associated libraries make heavy use of the Model View Controller (MVC) pattern. In general, MVC is a strategy for separating the presentation (View), data (Model), and business logic (Controller). In specific terms, the model is simply data, like a Person class or an Address. The view is responsible for rendering the data to the screen. In iOS development, that means a subclass of UIView. iOS provides a special class to act as the controller for a UIView, which is aptly named UIViewController.

UIViewController has two key characteristics: it is often associated with an XIB file and it has a property called “view” that is of type UIView. By creating a subclass of UIViewController, we can ...

Get Beginning iOS 5 Games Development: Using the iOS 5 SDK for iPad, iPhone, and iPod Touch 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.