开发者

iPhone Memory Management (UIBarButtonItem)

开发者 https://www.devze.com 2023-01-26 04:01 出处:网络
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

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

0

精彩评论

暂无评论...
验证码 换一张
取 消