It seems that the UIView has not methods like "didRemoveFromSuperview
" or "willRemoveFromSuperview
".Then,How to listen to the event when a UIView removed from its superView?I should use KVO? thanks in advance!
This topic is quite old, but I found a way to do it .Since google search wasn't helpful enough, here it is (taken from UIView's docs)
Observing View-Related Changes
– didAddSubview:
– willRemoveSubview:
– willMoveToSuperview:
– didMoveToSuperview
– willMoveToWindow:
– didMoveToWindow