一、挂起
当有电话进来或者锁屏,这时你的应用程会挂起,在这时,UIApplicationDelegate委托会收到通知,调用 applicationWillResignAct
当你的程序被挂起后他不会在后台运行。
二、复原
当程序复原时,另一个名为 applicationDidBecomeActi
注意:应用程序在启动时,在调用了 applicationDidFinishLaun
三、终止
当用户按下按钮,或者关机,程序都会被终止。当一个程序将要正常终止时会调用 applicationWillTerminate
- -
(BOOL)application:(UIApplication *)application didFinishLaunchingWithOp tions:(NSDictionary *)launchOptions - {
-
// Override point for customization after application launch. -
NSLog(@"\n ===> 程序开始 !"); -
-
return YES; - }
-
- -
(void)applicationWillResignAct ive:(UIApplication *)application - {
-
-
NSLog(@"\n ===> 程序暂行 !"); - }
-
- -
(void)applicationDidEnterBackg round:(UIApplication *)application - {
-
-
NSLog(@"\n ===> 程序进入后台 !"); - }
-
- -
(void)applicationWillEnterFore ground:(UIApplication *)application - {
-
-
NSLog(@"\n ===> 程序进入前台 !"); - }
-
- -
(void)applicationDidBecomeActi ve:(UIApplication *)application - {
-
NSLog(@"\n ===> 程序重新激活 !"); -
- }
-
- -
(void)applicationWillTerminate :(UIApplication *)application - {
-
NSLog(@"\n ===> 程序意外暂行 !"); -
-
UIDevice *device = [UIDevice currentDevice]; -
- }
首次运行:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOp
- (void)applicationDidBecomeActi
首次关闭(home):
- (void)applicationWillResignAct
- (void)applicationDidEnterBackg
再次运行:
- (void)applicationWillEnterFore
- (void)applicationDidBecomeActi
再次关闭:
- (void)applicationWillResignAct
- (void)applicationDidEnterBackg