[iOS]AppDelegate方法简单说明

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    
    NSLog(@"程序结束加载");
    return YES;
}

//当应用程序将要进入非活动状态执行,在此期间,应用程序不接受消息或事件
- (void)applicationWillResignActive:(UIApplication *)application {
    // 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.
    //使用这种方法暂停正在进行的任务,禁用计时器,节流OpenGL ES帧率。游戏应该使用这个方法来暂停游戏
    
     NSLog(@"应用程序将要进入非活动状态,即将进入后台");
}

//应用程序已经进入后台运行
- (void)applicationDidEnterBackground:(UIApplication *)application {
    // 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.
    //如果您的应用程序支持后台执行,当用户退出时会调用此方法,而不是调用applicationWillTerminate:
    
    NSLog(@"如果应用程序支持后台运行,则应用程序已经进入后台运行");

}

//应用程序将要进入活动状态执行
- (void)applicationWillEnterForeground:(UIApplication *)application {
    // 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.
    
//    从后台过渡到非活动状态时调用,在这里你可以撤消的许多进入后台时所做的更改
    NSLog(@"应用程序将要从后台进入活动状态,即将进入前台运行");
}

//应用程序已经进入活动状态
- (void)applicationDidBecomeActive:(UIApplication *)application {
    // 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.
    
    //重启任何任务暂停(或没有开始),而应用程序是不活跃的。如果应用程序在后台以前,可选更新用户界面
    
    NSLog(@"应用程序已进入前台,处于活动状态");
}

//应用程序将要退出,通常用于保存数据和一些推出前的清理工作
- (void)applicationWillTerminate:(UIApplication *)application {
    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
    
    //当应用程序终止时调用。适当的保存数据。参见applicationDidEnterBackground
    NSLog(@"应用程序将要退出,通常用于保存书架喝一些推出前的清理工作");
}


//当设备为应用程序分配了太多的内存,操作系统会终止应用程序的运行,在终止前会执行这个方法
//通常可以在这里进行内存清理工作,防止程序被终止
-(void)applicationDidReceiveMemoryWarning:(UIApplication *)application
{
    NSLog(@"系统内存不足,需要进行清理工作");
}

//当系统时间发生改变时执行
-(void)applicationSignificantTimeChange:(UIApplication *)application
{
    NSLog(@"当系统时间发生改变时执行");
}

//当程序载入后执行
-(void)applicationDidFinishLaunching:(UIApplication *)application
{
    NSLog(@"当程序载入后执行");
}

你可能感兴趣的:(启动,退出,appdelegate,程序加载)