Loaded and Appearing Views

Now that you have two view controllers, the lazy loading of views that you learned about earlier becomes more important.

When the application launches, the tab bar controller defaults to loading the view of the first view controller in its array, the BNRHypnosisViewController. This means that the BNRReminderViewController’s view is not needed and will only be needed when (or if) the user taps the tab to see it.

You can test this behavior for yourself – when a view controller finishes loading its view, it is sent the message viewDidLoad.

In BNRHypnosisViewController.m, override viewDidLoad to log a statement to the console.

-​ ​(​v​o​i​d​)​v​i​e​w​D​i​d​L​o​a​d​ {​ ​ ​ ​ ​/​/​ ​A​l​w​a​y​s​ ​c​a​l​l​ ...

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.