/*app
//UIApplicationDelegate委託代理方法代理
1.程序開始:didFinishLaunchingWithOptions:程序開始it
2.程序掛起:applicationWillResignActiveio
3.程序復原(程序從新激活):applicationDidBecomeActive後臺
注意:應用程序在啓動時,在調用了 applicationDidFinishLaunching 方法以後也會調用 applicationDidBecomeActive 方法,因此你要確保你的代碼可以分清復原與啓動,避免出現邏輯上的bug。bug
4.程序意外暫行(終止):applicationWillTerminate程序
5.程序進入後臺:applicationDidEnterBackground方法
6.程序進入前臺:applicationWillEnterForegrounddi
//調用方法場景co
首次運行:
didFinishLaunchingWithOptions//程序開始
applicationDidBecomeActive//程序復原(程序從新激活)
首次關閉(home):
applicationWillResignActive//程序掛起
applicationDidEnterBackground//程序進入後臺
再次運行:
applicationWillEnterForeground//程序進入前臺
applicationDidBecomeActive//程序復原(程序從新激活)
再次關閉:
applicationWillResignActive//程序掛起
applicationDidEnterBackground//程序進入後臺
*/
func applicationWillResignActive(_ application: UIApplication) {
application.applicationIconBadgeNumber = 0;
print("程序掛起")
}
func applicationDidBecomeActive(_ application: UIApplication) {
print("程序復原")
}
func applicationWillTerminate(_ application: UIApplication) {
print("程序終止")
}
func applicationDidEnterBackground(_ application: UIApplication) {
print("程序進入後臺")
}
func applicationWillEnterForeground(_ application: UIApplication) {
print("程序進入後臺")
}