User Tools

Site Tools


View Controllers

An Object that manages views and models, executing high-level code that deals with the major functionality of the app. Executes API calls. Executes transitions. Ultimate source of authority in app.

Represented by UIViewController in iOS; in order to realize custom functionality developer must subclass, as each custom controller must react differently to different events based on its purpose and views. This consists of two steps:

  • creating a new Objective-C class using File > New and ensuring it is a subclass of UIViewController
  • associating the newly created class with a controller displayed in the storyboard by using the Identity Inspector of InterfaceBuilder and changing the listed class

Changing the class of a controller in IB.

Each controller has a view property. The screen is ultimately constructed out of all the views the developer adds as subviews to this view through dragging and dropping (or code) in InterfaceBuilder. As such, each controller maintains a tree of subviews that interact dynamically at runtime.

ios-labs-s14/basics-controllers.txt · Last modified: 2014/02/26 13:29 by mbarboi