Interacting with View Controllers and Their Views

Let’s look at some methods that are called during the lifecycle of a view controller and its view. Some of these methods you have already seen, and some are new:

  • application:didFinishLaunchingWithOptions: is where you instantiate and set an application’s root view controller.

    This method gets called exactly once when the application has launched. Even if you go to another app and come back, this method does not get called again. If you reboot your phone and start the app again, application:didFinishLaunchingWithOptions: will get called again.

  • initWithNibName:bundle: is the designated initializer for UIViewController.

    When a view controller instance is created, its initWithNibName:bundle: ...

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.