AppDelegate生命周期
1. 應用程序啟動笑跛,并進行初始化時候調(diào)用該方法: didFinishLaunchingWithOptions?
2. 應用進入前臺并處于活動狀態(tài)時候調(diào)用: applicationDidBecomeActive
3. 應用從活動狀態(tài)進入到非活動狀態(tài): applicationWillResignActive
4. 應用進入到后臺時候調(diào)用的方法: applicationDidEnterBackground
5. 應用進入到前臺時候調(diào)用的方法: applicationWillEnterForeground
6. 應用將被終止的時候調(diào)用: applicationWillTerminate
ViewController生命周期
loadView→viewDidLoad→viewWillAppear→viewDidAppear→viewWillDisappear→viewDidDisappear→dealloc
1. loadView:一般情況下不用用到,除非需要重寫設(shè)置View热凹;
2. viewDidLoad/dealloc:視圖加載完成之后的設(shè)置和視圖銷毀的時候調(diào)用鹿霸;
3. viewWillAppear/viewWillDisappear:視圖即將呈現(xiàn)和視圖即將消失排吴;
4. viewDidAppear/viewDidDisappear:視圖展現(xiàn)在屏幕的時候和視圖完全消失在屏幕的時候調(diào)用,默認不做任何操作懦鼠;