iOS: Detect when my UIView is add in other view iOS: Detect when my UIView is add in other view ios ios

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.


  • For a UIView use - (void)didMoveToSuperview
  • For a UIViewController use -(void)viewWillAppear:(BOOL)animated


also assign THE TAG of Customview before addsubview and the detect by Particular TAG.


matomo