//网络引用 @protocol UIApplicationDelegate @optional //常用的: - (void)applicationDidFinishLaunching:(UIApplication *)application;//当程序完成载入后调用 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_0); //当程序完成载入,并且可能有额外的启动选项时被调用,建议用此方法来初始化应用程序 - (void)applicationDidBecomeActive:(UIApplication *)application;//应用程序转为激活状态时被调用 - (void)applicationWillResignActive:(UIApplication *)application;//应用程序转为后台(非激活)状态时被调用 - (void)applicationWillTerminate:(UIApplication *)application; //当程序将要退出是被调用,通常是用来保存数据和一些退出前的清理工作。这个需要要设置UIApplicationExitsOnSuspend的键值。
- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application; // try to clean up as much memory as possible. next step is to terminate app//内存较低时调用 - (void)applicationDidEnterBackground:(UIApplication *)application __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_4_0);//当程序被推送到后台的时候调用。所以要设置后台继续运行,则在这个函数里面设置即可
- (void)applicationWillEnterForeground:(UIApplication *)application __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_4_0);//当程序从后台将要重新回到前台时候调用,这个刚好跟上面的那个方法相反。
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url; //请求委托打开一个URL资源 - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_4_2); // no equiv. notification. return NO if the application can't open for some reason //请求委托打开一个URL资源 - (void)applicationSignificantTimeChange:(UIApplication *)application; // midnight, carrier time update, daylight savings time change //当系统时间发生改变时执行 //设置 StatusBar 状态
- (void)application:(UIApplication *)application willChangeStatusBarOrientation:(UIInterfaceOrientation)newStatusBarOrientation duration:(NSTimeInterval)duration; //当StatusBar框方向将要变化时执行 - (void)application:(UIApplication *)application didChangeStatusBarOrientation:(UIInterfaceOrientation)oldStatusBarOrientation; //当StatusBar框方向改变时执行 - (void)application:(UIApplication *)application willChangeStatusBarFrame:(CGRect)newStatusBarFrame; // in screen coordinates //当StatusBar框方向将要改变时执行 - (void)application:(UIApplication *)application didChangeStatusBarFrame:(CGRect)oldStatusBarFrame; //当StatusBar框方向改变时执行 // one of these will be called after calling -registerForRemoteNotifications - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_0);//当一个应用程序成功的注册一个推送服务(APS) 发送到委托去
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_0);//当一个应用程序注册一个推送服务(APS) 发送到委托中失败时执行
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_0); //当一个运行着的应用程序收到一个远程的通知 发送到委托去...
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_4_0);//当一个运行着的程序接受一个本地的通知时执行
- (void)applicationProtectedDataWillBecomeUnavailable:(UIApplication *)application __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_4_0);//通知委托,受保护的文件当前变为不可用的
- (void)applicationProtectedDataDidBecomeAvailable:(UIApplication *)application __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_4_0);//通知委托,受保护的文件当前变为可用的