Cover by Joe Conway, Aaron Hillegass

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

O'Reilly logo

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required