UIViewController Initializers

When you created a tab bar item for BNRHypnosisViewController, you overrode initWithNibName:bundle:. However, when you initialized the BNRHypnosisViewController instance in BNRAppDelegate.m, you sent it init and still got the tab bar items. This is because initWithNibName:bundle: is the designated initializer of UIViewController. Sending init to a view controller calls initWithNibName:bundle: and passes nil for both arguments.

BNRHypnosisViewController does not use a NIB file to create its view, so the filename parameter is irrelevant. What happens if you send init to a view controller that does use a NIB file? Let’s find out.

In BNRAppDelegate.m, change your code to initialize the BNRReminderViewController ...

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.