1 //1.在应用程序加载完毕之后调用 2 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 3 4 return YES; 5 } 6 7 //2.程序失去焦点的时候调用(不能跟用户进行交互了) 8 - (void)applicationWillResignActive:(UIApplication *)application { 9 10 }11 12 //3.当程序被推送到后台的时候调用(点击HOME键)。所以要设置后台继续运行,则在这个函数里面设置即可13 - (void)applicationDidEnterBackground:(UIApplication *)application {14 15 }16 17 //4.当程序从后台将要重新回到前台时候调用,这个刚好跟上面的第3个方法相反18 - (void)applicationWillEnterForeground:(UIApplication *)application {19 20 }21 //5.当应用程序获取焦点的时候调用,这个刚好跟上面第2个方法相反22 - (void)applicationDidBecomeActive:(UIApplication *)application {23 24 }25 //6.当程序在某些情况下被终结时会调用这个方法,通常是用来保存数据和一些退出前的清理工作。这个需要设置UIApplicationExitsOnSuspend的键值26 - (void)applicationWillTerminate:(UIApplication *)application {27 28 }29 //7.iPhone设备只有有限的内存,如果为应用程序分配了太多内存操作系统会终止应用程序的运行,在终止前会执行这个方法,通常可以在这里进行内存清理工作防止程序被终止30 - (void)applicationDidReceiveMemoryWarning:(UIApplication *)application{31 32 }33 //8.当系统时间发生改变时执行34 - (void)applicationSignificantTimeChange:(UIApplication *)application{35 36 }37 //9.当程序载入后执行38 - (void)applicationDidFinishLaunching:(UIApplication *)application{39 40 }41 //10.当StatusBar框将要变化时执行42 - (void)application:(UIApplication *)application willChangeStatusBarFrame:(CGRect)newStatusBarFrame __TVOS_PROHIBITED{43 44 }45 //11.当StatusBar框方向将要变化时执行46 - (void)application:(UIApplication *)application willChangeStatusBarOrientation:(UIInterfaceOrientation)newStatusBarOrientation duration:(NSTimeInterval)duration{47 48 }49 //12.当通过url执行50 - (BOOL)application:(UIApplication *)application handleOpenURL:(nonnull NSURL *)url{51 return YES;52 }53 54 //13.当StatusBar框方向变化完成后执行55 - (void)application:(UIApplication *)application didChangeStatusBarOrientation:(UIInterfaceOrientation)oldStatusBarOrientation{56 57 }58 //14.当StatusBar框架变化完成后执行59 - (void)application:(UIApplication *)application didChangeStatusBarFrame:(CGRect)oldStatusBarFrame{60 61 }62 63 //15.当一个运行着的应用程序收到一个远程的通知时 发送委托, 远程推送64 - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo65 {66 67 }68 69 //16.当一个应用程序成功的注册一个推送服务(APS)70 -(void) application:(UIApplication *) applicationdidRegisterForRemoteNotificationsWithDeviceToken:(NSData *) deviceToken{71 72 }
1 //应用程序接收到了本地通知2 - (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification3 {4 5 }