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