View Controller Lifecycle

A UIViewController begins its life when it is allocated and sent an initializer message. A view controller will see its view created, moved on screen, moved off screen, destroyed, and created again – perhaps many times over. These events make up the view controller lifecycle.

Initializing view controllers

The designated initializer of UIViewController is initWithNibName:bundle:. This method takes two arguments that specify the name of the view controller’s XIB file inside a bundle. (Remember that building a target in Xcode creates an application bundle; this is the same kind of bundle we’re talking about here.)

Passing nil for both arguments says, When you load your view, search for a XIB file whose name is the same ...

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.