iPhone,addSubView不会调用willViewAppear? [英] iPhone, addSubView doesn't call willViewAppear?
问题描述
我正在使用 -addSubView
添加视图。我也在其他地方使用视图和 presentModalViewController
。
I'm adding a view with -addSubView
. I'm also using the view elsewhere and presentModalViewController
.
-viewWillAppear
使用presentModalViewController调用,但不调用addSubView。
-viewWillAppear
is called with presentModalViewController but not with addSubView.
毫无疑问这是显而易见的事情?
No doubt this is something obvious ?
推荐答案
viewWillAppear:
当父视图控制器呈现另一个视图控制器时调用>(例如,通过 pushViewController:animated:
或 presentModalViewController:animated:
)。当您手动调用 addSubview时,它永远不会被调用:
。
viewWillAppear:
is called by the parent view controller when it presents another view controller (e.g. by pushViewController:animated:
or presentModalViewController:animated:
). It is never called when you manually call addSubview:
.
这篇关于iPhone,addSubView不会调用willViewAppear?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!