iOS APP各種狀態(進入後臺,前臺等)

weixin_33912445發表於2016-04-28

整理:http://www.jianshu.com/p/096bdd17449e

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

{

// Override point for customization after application launch.

NSLog(@"\n ===> 程式開始 !");

return YES;

}

- (void)applicationWillResignActive:(UIApplication *)application

{

NSLog(@"\n ===> 程式暫行 !");

}

- (void)applicationDidEnterBackground:(UIApplication *)application

{

NSLog(@"\n ===> 程式進入後臺 !");

}

- (void)applicationWillEnterForeground:(UIApplication *)application

{

NSLog(@"\n ===> 程式進入前臺 !");

}

- (void)applicationDidBecomeActive:(UIApplication *)application

{

NSLog(@"\n ===> 程式重新啟用 !");

}

- (void)applicationWillTerminate:(UIApplication *)application

{

NSLog(@"\n ===> 程式意外暫行 !");

UIDevice *device = [UIDevice currentDevice];

}



首次執行:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

- (void)applicationDidBecomeActive:(UIApplication *)application

首次關閉(home):

- (void)applicationWillResignActive:(UIApplication *)application

- (void)applicationDidEnterBackground:(UIApplication *)application

再次執行:

- (void)applicationWillEnterForeground:(UIApplication *)application

- (void)applicationDidBecomeActive:(UIApplication *)application

再次關閉:

- (void)applicationWillResignActive:(UIApplication *)application

- (void)applicationDidEnterBackground:(UIApplication *)application

相關文章