This is a bit advanced as I’ve returned to this chapter to check my knowledge… (newbies, don’t freak )
The UINavigationItem never gets alloc’d and init’d in the BNR iPhone book (p. 171), which makes me think that it is probably lazily loaded by the UIViewController super class when a subclass’d VC’s navigation item is messaged. I’ve tried to confirm this with the debugger, showing that the UINavigationItem is indeed nil until messaged.
My questions are…
[ul][li]Why put these calls in the init method instead of the viewDidLoad? Personal preference?
Heeding advice from page 114 says don’t manipulate views in init, but doesn’t this kinda count, too?
[li]Won’t putting the setup messages in viewDidLoad ensure that the Nav Item exists in the off chance the VC has to release because of a memory warning?
I mean the root view controller won’t ever get dealloc’d in this particular example, but if this were a leaf / detail VC on the navigation stack it’s plausible that it would get killed during the lifecycle of a rather complex view intense app.
[li]I guess a broader question is: doesn’t sticking these setup calls in viewDidLoad continue the spirit of lazy loading?[/li][/ul]