程序啟動過程分為2類:
1.有storyboard:
1.main 函數(shù)
2.UIApplicationMain
創(chuàng)建 UIApplication 對象
創(chuàng)建 UIApplication 的 delegate 對象
3.根據(jù)Info.plist 獲得最主要storyboard的文件名,加載最主要的storyboard(有 storyboard)
創(chuàng)建 UIWindow
創(chuàng)建和設(shè)置 UIWindow 的 rootViewController
顯示窗口
2.沒有storyboard
1.main 函數(shù)
2.UIApplicationMain
創(chuàng)建 UIApplication 對象
創(chuàng)建 UIApplication 的 delegate 對象
3.delegate 對象開始處理(監(jiān)聽)系統(tǒng)事件(沒有 storyboard)程序啟動完畢的時候, 就會調(diào)用代理的application:didFinishLaunchingWithOptions:方法在application:didFinishLaunchingWithOptions:中創(chuàng)建 UIWindow創(chuàng)建和設(shè)置 UIWindow 的 rootViewController* 顯示窗口