iOS: Detect when my UIView is add in other view
You can use willMoveToSuperview: and didMoveToSuperview to detect when the view is moved around. layoutSubviews will be called when the superview changes frame.
You can use willMoveToSuperview: and didMoveToSuperview to detect when the view is moved around. layoutSubviews will be called when the superview changes frame.
If you’re calling this directly from a UIView (and not a UIViewController), it should be self.superview instead of self.view.superview.