iOS-note

1.To preserve the benefit of lazy loading, you should never access the VIEW property of a view controller in initWithNibName:bundle:.Asking for the view in the initializer will cause the view controller to load its VIEW prematurely.

 

 

2. viewDidLoad和viewWillAppear:view controller收到viewDidLoad消息时,是在这个view controller的NIB文件已经加载后,此时view controller所有的指针都指向了正确的对象。

viewWillAppear消息发送给view controller时,是在它的view被添加到window之前。

1) 如果在程序运行过程中只需要配置一次的,在viewDidload中实现。

2) 如果这些配置需要在每次这个view controller出现在屏幕上时都要重新做一次,需要在viewWillAppear中实现。

posted on 2016-01-04 14:39  SomeBod_Y  阅读(127)  评论(0编辑  收藏  举报