[英]about UIView addSubview
I have two UIViews, named A and B, and I add UIView B into A's subviews: 我有两个UIView,分别称为A和B,并将UIView B添加到A的子视图中:
[A.view addSubview B]
I am wondering is there any delegation or hook that B can be informed "Oh, I was added into A!" 我想知道是否有任何委托或钩子可以告知B“哦,我被加进A了!” when it was added to A?
当它被添加到A? or any other way to let B know it was added to some other UIView container?
还是让B知道它已添加到其他UIView容器的任何其他方式?
您可以在UIView
子类中重写willMoveToSuperview:
或didMoveToSuperview
方法,以便在将视图添加到另一个视图时得到通知。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.