ViewController 生命周期
单个viewController的生命周期
- initWithCoder:(NSCoder *)aDecoder:(如果使用storyboard或者xib) - loadView:加载view - viewDidLoad:view加载完毕 - viewWillAppear:控制器的view将要显示 - viewWillLayoutSubviews:控制器的view将要布局子控件 - viewDidLayoutSubviews:控制器的view布局子控件完成 - viewDidAppear:控制器的view完全显示 - viewWillDisappear:控制器的view即将消失的时候 - viewDidDisappear:控制器的view完全消失的时候 - dealloc 控制器销毁
两个控制器AB进行跳转调用顺序:
A控制器先展示调用
- [ViewControllerA loadView] - [ViewControllerA viewWillAppear:] - [ViewControllerA viewWillLayoutSubviews] - [ViewControllerA viewDidLayoutSubviews] - [ViewControllerA viewDidAppear:]
B控制器跳转调用顺序
- [ViewControllerB loadView] - [ViewControllerB viewDidLoad] - [ViewControllerA viewWillDisappear:] - [ViewControllerB viewWillAppear:] - [ViewControllerB viewWillLayoutSubviews] - [ViewControllerB viewDidLayoutSubviews] - [ViewControllerA viewDidDisappear:] - [ViewControllerB viewDidAppear:]
B控制器返回A顺序
- [ViewControllerB viewWillDisappear:] - [ViewControllerA viewWillAppear:] - [ViewControllerB viewDidDisappear:] - [ViewControllerA viewDidAppear:]
在北京的灯中,有一盏是我家的。这个梦何时可以实现?哪怕微微亮。北京就像魔鬼训练营,有能力的留,没能力的走……