// 1.应用程序启动完成,会调用此方法,启动之后,将不再调用此方法!
//如果因为内存等原因,应用程序被操作系统干掉,再次点击图标,会调用此方法!
- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
{
NSLog(@"应用程序启动");
returnYES;
}
// 2.应用程序注销激活状态,游戏应该再此方法中暂停游戏进程!此方法在游戏开发中尤为重要!
- (void)applicationWillResignActive:(UIApplication*)application
{
NSLog(@"%s", __func__);
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
// 3.应用程序退出到后台,释放共享资源,保存用户数据,停止时钟,保存足够的应用程序状态信息...
- (void)applicationDidEnterBackground:(UIApplication*)application
{
NSLog(@"%s", __func__);
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
// 4.应用程序进入前台,如果在进入后台保存数据等操作,在此方法中,回复进入后台的操作
- (void)applicationWillEnterForeground:(UIApplication*)application
{
NSLog(@"%s", __func__);
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}
// 5.应用程序变成活动状态,重新启动原来暂停的状态
- (void)applicationDidBecomeActive:(UIApplication*)application
{
NSLog(@"%s", __func__);
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
// 6.应用程序将被终止
- (void)applicationWillTerminate:(UIApplication*)application
{
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
@end