If you implement willMoveToSuperview
on a UIView
subclass, is it guaranteed to be called (with nil
) when removeFromSuperview
is called on your view?
The docs say that the newSuperview
parameter may be nil
and that it's called "whenever the superview changes" but I'm not sure if I can interpret this to mean it will be called when the view is removed from its superview even when not being moved to a different superview.
Whenever a view receives
removeFromSuperview
, and the view's superview was not already nil, the view will always do[self willMoveToSuperview:nil]
.