问题描述
在ARC中,我知道您不会在-dealloc
的任何替代中调用[super dealloc]
,因此通常我不这样做而删除其中的观察者和计时器.但是,如果我要细分一个使在-dealloc
中释放观察信息而不在该方法的子类的实现中调用[super dealloc]
的视图的子类,那么将自动调用super实现以释放由超类处理的观察信息,还是会泄漏?
In ARC I'm aware that you do not call [super dealloc]
in any overrides of -dealloc
, so typically I remove observers and timers in there without doing so. However, if I were to subclass a view that I made that releases observation info in -dealloc
without calling [super dealloc]
in the subclass' implementation of the method, would the super implementation be called automatically to release the observation info handled by the superclass, or would it leak?
推荐答案
将自动调用dealloc
的超类实现(据我所知,编译器会为您插入语句[super dealloc]
).
The superclass' implementation of dealloc
is automatically called (as far as I know, the compiler inserts the statement [super dealloc]
for you).
这里是参考:
这篇关于ARC子类上的超级解除分配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!