Difference Between UIView and UIViewController in iPhone

The difference is due to the Model-View-Controller pattern (MVC) used throughout Cocoa Touch.


MVC is used to separate the application data from the way it is displayed on screen:
  • Model refers to the application data model, such as a database of names, dates of birth and so on.


  • View refers to the actual user interface elements that are displayed on screen. A UIView, UIButton, UITableView etc. are all examples of View elements.


  • Controller refers to "mediating" objects that act between the Model(s) and the View(s). Controllers usually contain most of the application logic such as handling user input, filtering data from the Model based on user input, and then updating the View elements to display the correct values.

Here is detailed Pattern

A design pattern in which the model (any data in your program), the view (what the user sees), and the controller (a layer that handles all interaction between the view and model) are separated in such a manner that modifying either the view or model component of your program has no effect on one another.

Model:The model contains the data.

View: The view displays information contained in the model.

Controller: the controller is responsible for accessing data from the model and displaying it on the view.

MVC-in-iPhone.jpg


Similar Articles