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 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.