Understanding the MVC in the Project

As one might expect, when you create an Xcode project, any and all classes added to the project by the template correspond to the Model-View-Controller design pattern. No surprises there.

If you look carefully, you can actually see how the features of the MVC model end up getting translated into a real, live project. Start by checking out the Project navigator, where you see RTMasterViewController .h and .m files, RTDetailViewController .h and .m files, and RTAppDelegate .h and .m files. (Remember that, because everything is built in split view, you’re going to see two controllers — one for the Master view and one for the Detail view. I explain that in detail in Chapter 13.)

The interface (.h file) contains the class declaration and the methods and properties associated with the class. But although the interface file has traditionally also included the instance variables, you’re actually going to include all instance variables in the implementation file instead, so you can keep them away from prying eyes. (You can find more on hiding the instance variables in Chapter 7.)

The implementation (.m file) contains the actual code for the methods of the class and — as just mentioned — also includes your instance variables.

The RTMasterViewController and RTDetailViewController correspond to the controllers I explain in the “View Controllers — the Main Storyboard Players” section, earlier in this chapter. But where are the classes that correspond to ...

Get iPad Application Development For Dummies, 3rd Edition 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.