Pull Yourself Together

Now that you've seen the views and models in the application, it's time to examine how controllers make everything work together. They're the glue that pulls your flashlight together.

You've already had a preview of the controllers: There's one controller for each of the NIB files that contains a view (User Interface: The Easy Way, for example). Of course, the basic controller created by Xcode doesn't have any instance variables or actions, nor does it have any of the logic specific to the application.

So hop back in the bus and let the tour continue.…

MainViewController

The design of the main flashlight view is simple by design. This leads to a controller that uses both models, but only has three view outlets. Two of the views are custom UIView subclasses. As with most controllers, the interesting part is how it interacts with the views and models.

Get iPhone App Development: The Missing Manual 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.