如果我使用 Interface Builder 创建视图,我应该清理什么
当 Interface Builder 为我创建了子视图(任何 UIView)时,我是否需要将其从超级视图中删除并在 dealloc 中自行释放?
When Interface Builder has created subview (any UIView) for me then do i need to remove it from superview and release it myself in dealloc?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不,除非您有自己管理的单独渠道。在 IB 中仅作为子视图存在的 UIView 由其超级视图的状态管理。
Nope, not unless you have a separate outlet for it that you're managing yourself.
UIViews
that exist solely as subviews in IB are managed by the state of their superview.如果您在 Interface Builder 中连接 IBOutlet 并在控制器中创建了 @properties 来保留它们,那么您将需要自己释放它们,因为您的控制器将增加对象的保留计数。
If you are connecting you IBOutlets in Interface Builder and have created @properties in your controller to retain them then you will need to release them yourself, since your controller will have increased the retain count on the object.