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

很明显,先执行init、然后执行viewDidLoad,然后是viewWillAppear最后是viewDidAppear,这样视图就创建好了,当视图消失或者被覆盖的时候:

2012-10-19 15:54:14.557inHyron[483:b903] viewWillDisappear

2012-10-19 15:54:14.558inHyron[483:b903] viewDidDisappear

这样一来视图就消失了,当模拟内存警告的时候:

2012-10-19 15:55:14.333inHyron[483:b903] Received simulated memory warning.

2012-10-19 15:55:14.334inHyron[483:b903] viewWillUnload

2012-10-19 15:55:14.335 inHyron[483:b903]viewDidUnload

你可能感兴趣的:(init、viewDidLoad、viewWillAppear、viewDidAppear、viewWillDisappear、viewDidDisappear的执行顺序)