Pregunta

I have two UIViews, named A and B, and I add UIView B into A's subviews:

[A.view addSubview B]

I am wondering is there any delegation or hook that B can be informed "Oh, I was added into A!" when it was added to A? or any other way to let B know it was added to some other UIView container?

¿Fue útil?

Solución

You can override the willMoveToSuperview: or didMoveToSuperview methods in a UIView subclass in order to be informed when the view is added to another view.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top