P. 235 - Why use the setter?


In the code up to this point the “item” is a property that is synthesized. The text suggests we override the setter methods that would be created by the compiler. We do this to set the navigation item title.

Why would we not simply add that call to the end of the viewWillAppear: method that we already have? I added:

…to the viewWillAppear: method and everything seems to work fine. Am I missing something?


If, later on, you’d like to add the ability to change the current item without leaving this view (perhaps adding up and down arrows to the DetailViewController that take you to the next/previous item in the list), viewWillAppear: wouldn’t be called again.

Basically, the title of the navigation item depends on the current BNRItem, so it makes sense that it would only change if that item changed and always change when that item changed.