2.0. Introduction

All iOS applications essentially use the Model-View-Controller, or MVC architecture. Model, view, and controller are the three main components of an iOS application from an architectural perspective.

The model is the brain of the application. It does the calculations and creates a virtual world for itself that can live without the views and controllers. In other words, think of a model as a virtual copy of your application, without a face!

A view is the window through which your users interact with your application. It displays what’s inside the model most of the time, but in addition to that, it accepts users’ interactions. Any interaction between the user and your application is sent to a view, which then can be captured by a view controller and sent to the model.

Controllers in iOS programming usually refer to view controllers. Think of view controllers as a bridge between the model and your views. They interpret what is happening on one side (what the user does on the view side, or the information provided by the model) and use that information to alter the other side as needed.

In this chapter, you will learn how the structure of an iOS application is created and how to use views and view controllers to create intuitive applications.

Note

In this chapter, for most of the UI (User Interface) components that we create, we are using a Single View Application template in Xcode. To reproduce the examples, follow the instructions in Recipe 1.1 but instead of a Page-Based ...

Get iOS 6 Programming Cookbook 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.