문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top