iPhone、Mac OS 开发和 IBOutlets
当我阅读文档时,在 mac os x 开发中,我不必为 IBOutlet 创建属性(因为视图控制器或任何保留需要保留的对象,因此只保留那些将被释放的对象),并且没有释放插座。在iPhone编程中,我不必拥有属性(因为视图控制器或任何保留所有对象的东西),但我必须在viewDidUnload中释放它们......。我是真的吗?或不 ? :)
as im reading the docs, in mac os x development i dont have to make properties for IBOutlets (because the viewcontroller or whatever retains the objects that needs to be retained, so only those which would be deallocated are retained), and don't have to release the outlets. in iphone programming, i don't have to have properties (because the viewcontroller or whatever retains all the objects), but i have to release them in viewDidUnload…. am i true ? or not ? :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
iOS 方面的总结就到此为止。我不确定 Mac OS 视图控制器是否能够自动释放其插座,但在 iOS 上,除非您将
IBOutlet
指定为不带retain
属性的属性(即分配
),您负责在-viewDidUnload
中释放它。That about summarizes it, on the iOS side. I'm not sure about the Mac OS view controllers being able to automatically release their outlets, but on iOS, unless you specify the
IBOutlet
as a property with noretain
attribute (i.e.assign
), you're responsible for releasing it in-viewDidUnload
.