iOS Appdelegate代理方法说明和触发条件

来源:互联网 发布:软件实施工程师待遇 编辑:程序博客网 时间:2024/05/22 18:38

From:http://snowyshell.blog.163.com/blog/static/2209140342013917112731789/

1.- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

{

    NSLog(@"启动App");

    // Override point for customization after application launch.

    return YES;

}

2.- (void)applicationWillResignActive:(UIApplication *)application

{

    NSLog(@"进入非活动状态,如:来电话");

    // 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(@"进入后台,home键或来电话");

    // 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(@"重新回到app");

    // 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(@"回到活动状态");

    // 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

{

    NSLog(@"程序将要退出");

    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.

}

0 0
原创粉丝点击