iPhone Memory Management (UIBarButtonItem)
In my .h file I dec开发者_开发技巧lare 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?
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
.
You should release it and optionally set it to nil in your dealloc method. Apples documentation on this is available here: Memory Management Programming Guise
精彩评论