iPhone / iOS:如果将UIView添加为子视图,是否会调用任何方法 [英] iPhone/iOS: Will there be called any method if a UIView is added as a subview
本文介绍了iPhone / iOS:如果将UIView添加为子视图,是否会调用任何方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我将视图添加为子视图,那么
If I add a view as a subview like so
[self.view addSubview:mySubview];
mySubview上是否会调用任何方法,我可以覆盖以添加一些自定义行为?
Will there be called any method on mySubview, that I could override to add some custom behavior?
推荐答案
将视图添加到(新)超级视图触发器
Adding a view to a (new) superview triggers
- (void)willMoveToSuperview:(UIView *)newSuperview
和
- (void)didMoveToSuperview
。
请参阅 UIView参考了解更多信息。
这篇关于iPhone / iOS:如果将UIView添加为子视图,是否会调用任何方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文