iOS: Detect when my UIView is add in other view

ios, superview, uiview

Solution

You can use `willMoveToSuperview:` and `didMoveToSuperview` to detect when the view is moved around. `layoutSubviews` will be called when the superview changes frame.

Problem

``` CustomView *customView = [...]; [self.view addSubview:customView]; ``` I need to detect in my CustomView class when it is added in other views or when my superview changes.

Original source