fabian789 fabian789 - 27 days ago 5
Objective-C Question

iPhone Memory Management (UIBarButtonItem)

In my .h file I declare a

UIBarButtonItem
called
saveButton
, that will be displayed in the User Interface. The button itself is created in
viewDidLoad
(not via Interface Builder). Do I now have to set it to
nil
in
viewDidUnload
? Which of Apple's documents explains stuff like that?

Answer

I set my objects to nil in viewDidUnload and release them in dealloc. Due to memory warnings your view can get unloaded and then loaded again when you need it which is why I initialise my properties in viewDidLoad.