Model-View-Controller

You may hear iOS programmers mention the Model-View-Controller pattern. What this means is every object you create is exactly one of the following: a model object, a view object, or a controller object.

View objects are visible to the user. In Quiz, the buttons, labels, and the view they are placed on top of are all view objects. Views are usually standard UIView subclasses (UIButton, UISlider), but you will sometimes write custom view classes. These typically have names like DangerMeterView or IncomeGraphView.

Model objects hold data and know nothing about the user interface. In this application, the model objects will be two lists of strings: the questions array and the answers array. Figure 1.10 displays the object ...

Get iOS Programming: The Big Nerd Ranch Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.