简体   繁体   English

要取消ARC下自定义UIView的dealloc中的出口?

[英]To nil out outlets in a custom UIView's dealloc under ARC?

Usually in a UIViewController subclass, I nil out all outlets in viewDidUnload. 通常在UIViewController子类中,我将viewDidUnload中的所有出口都淘汰掉。 But in my custom UIView, should I nil out those outlets (defined in my custom UIView) in dealloc instead? 但是,在我的自定义UIView中,应该改为在dealloc中淘汰那些出口(在我的自定义UIView中定义)吗? Does ARC perform these actions automatically? ARC是否自动执行这些操作?

No, still do it in viewDidUnload to get them out of memory as fast as possible. 不,仍然在viewDidUnload中执行此操作,以使其尽快脱离内存。

ARC means you don't need to do it anywhere but it's still a bit more efficient if you do. ARC意味着您无需在任何地方进行操作,但是这样做仍然可以提高效率。

Though you don't ever need to nil properties in deadlock when using arc in any of your classes. 尽管在任何类中使用arc时都不需要在死锁中设置零属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM