I am adding a KVO observer on a subclass of UIView to one of its subviews. I also have a strong reference to the subview. When I call removeObserver
on the subview in dealloc
, can I assume that the subview still exists? I don't want to leak the observer.
Basically, when dealloc
is called in ARC, is the automatic call to [super dealloc]
before or after this call?
From http://clang.llvm.org/docs/AutomaticReferenceCounting.html
A class may provide a method definition for an instance method named
dealloc
. This method will be called after the finalrelease
of the object but before it is deallocated or any of its instance variables are destroyed. The superclass’s implementation ofdealloc
will be called automatically when the method returns.
So [super dealloc]
is called after calling the subclass dealloc
implementation.