Should UITabBarItem attributes be set in initialiser


#1

In the lazy loading section of the chapter just ran the app after adding bg color to time view controller, then simulating a memory warning to see the bg color disappear as the overriden initialization method is not rerun.

In this case the UITabBarItem is not destroyed because it always remains in view (I assume), but in an app which has a view not containing the tab bar, if a memory warning occurs on another view not containing the UITabBarItem, would this not also be destroyed? And if so, does this mean that it would be better to define the UITabBarItem’s attributes in the viewDidLoad method instead of the initialiser, or in that case would the entire hierarchy containing the tab bar and multiple view controllers be re-initialized when control passes back to it?


#2

Tab bar items aren’t views and don’t consume enough memory (they are a short string and a tiny image) that a low memory situation would be alleviated by destroying them. That and they also need to always be visible.