BUT which method is called when the view is removed from the superview (if any)?
-removeFromSuperview
is called, so you can override that if you need to do some housekeeping when the view is removed. Just remember to call super
's version, too.
-layoutSubviews
isn't necessarily only called when the view is added to a superview -- it's called whenever layout is needed. For example, it might be called when the orientation changes, or when the superview lays itself out again, or when the view's frame changes. There's really not an inverse of -layoutSubviews
because none is needed. (What would it be called? -messupSubviews
? ;-))