How do you handle memory management of outlets in the iPhone SDK

和自甴很熟 提交于 2019-12-04 21:46:58

I go with weak references. As you say its less cluttered and makes an already overly verbose code foorprint a little more manageable

Weak references are easier, yes. Clearer? A retain property as just as clear, and you can be more explicit about when something is released.

Personally I like to primarily use properties to expose some attribute of the class to the outside world - so for IBOutlets only the class will manipulate, I simply declare them without using properties and release them in dealloc.

In either case set to nil IBOutlet references in viewDidUnload.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!