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以前。rem

1) 若是在程序運行過程當中只須要配置一次的,在viewDidload中實現。it

2) 若是這些配置須要在每次這個view controller出如今屏幕上時都要從新作一次,須要在viewWillAppear中實現。配置

相關文章
相關標籤/搜索
本站公眾號
   歡迎關注本站公眾號,獲取更多信息