iOS视图控制对象生命周期:
init、viewDidLoad、viewWillAppear、viewDidAppear、viewWillDisappear、viewDidDisappear的区别及用途
init-初始化程序
viewDidLoad-加载视图
viewWillAppear-UIViewController对象的视图即将加入窗口时调用;
viewDidApper-UIViewController对象的视图已经加入到窗口时调用;
viewWillDisappear-UIViewController对象的视图即将消失、被覆盖或是隐藏时调用;
viewDidDisappear-UIViewController对象的视图已经消失、被覆盖或是隐藏时调用;
init、viewDidLoad、viewWillAppear、viewDidAppear、viewWillDisappear、viewDidDisappear的执行顺序:
从程序的log来看:
2012-10-19 15:51:44.811inHyron[483:b903] init
2012-10-19 15:51:54.081inHyron[483:b903] viewDidLoad
2012-10-19 15:51:54.082inHyron[483:b903] viewVillAppear
2012-10-19 15:51:54.084 inHyron[483:b903] viewDidAppear
viewDidLoad、viewWillAppear、viewDidAppear、viewWillDisappear、viewDidDisappear
最新推荐文章于 2020-05-26 16:49:50 发布