UIViewController生命周期
2014-11-19 17:03
134 查看
琢磨清楚UIViewController的生命周期是蛮有用的,这意味着你可以使其在正确的阶段做正确的事情。
参看UIViewController的生命周期及iOS程序执行顺序 蛮有价值的一篇文章。
此外,补上几点来自于官方的说明:
- (void)loadView
If you use Interface Builder to create your views and initialize the view controller, you must not override this method.
You can override this method in order to create your views manually. If you choose to do so, assign the root view of your view hierarchy to the view property.
Your custom implementation of this method should not call super
- (void)viewDidLoad
This method is called regardless of whether the view hierarchy was loaded from a nib file or created programmatically in the loadView method.
其他:在dealloc中注销订阅的NSNotification以及KVO。
参看UIViewController的生命周期及iOS程序执行顺序 蛮有价值的一篇文章。
此外,补上几点来自于官方的说明:
- (void)loadView
If you use Interface Builder to create your views and initialize the view controller, you must not override this method.
You can override this method in order to create your views manually. If you choose to do so, assign the root view of your view hierarchy to the view property.
Your custom implementation of this method should not call super
- (void)viewDidLoad
This method is called regardless of whether the view hierarchy was loaded from a nib file or created programmatically in the loadView method.
其他:在dealloc中注销订阅的NSNotification以及KVO。
相关文章推荐
- SOA 生命周期
- Android Fragment详解(二):Fragment创建及其生命周期
- (3)PHP生命周期和Zend引擎
- Servlet的生命周期,Servlet和CGI的区别
- Java类的生命周期包括哪几个阶段?
- AspNet2.0页面生命周期
- 理解Fragment生命周期
- react学习笔记(2)---组件的生命周期
- iOS多线程之1.从Thread看多线程的生命周期
- 类的整个生命周期
- 程序员的生命周期
- Android应用程序中Activity的生命周期
- Android-Service (基本知识,生命周期,实例-startService 启动的服务音乐播放器后台服务播放)
- Java程序的生命周期
- Maven的生命周期和插件(五)
- Microsoft .Net Remoting系列专题之二 Marshal,Disconnect与生命周期以及跟踪服务
- [iOS] ViewController的生命周期及其加载View的步骤
- Service和IntentService生命周期
- fragment生命周期
- 线程生命周期