iOS应用程序生命周期各个函数方法详解
来源:互联网 发布:统计贸易数据自查报告 编辑:程序博客网 时间:2024/04/30 20:03
- - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
- {
- self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
- // Override point for customization after application launch.
- self.window.backgroundColor = [UIColor whiteColor];
- [self.window makeKeyAndVisible];
- NSLog(@"iOS_didFinishLaunchingWithOptions");
- 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.
- NSLog(@"iOS_applicationWillResignActive");
- }
- - (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.
- NSLog(@"iOS_applicationDidEnterBackground");
- }
- - (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(@"iOS_applicationWillEnterForeground");
- }
- - (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(@"iOS_applicationDidBecomeActive");
- }
- - (void)applicationWillTerminate:(UIApplication *)application
- {
- // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
- NSLog(@"iOS_applicationWillTerminate");
- }
2、applicationWillResignActive:在应用程序将要由活动状态切换到非活动状态时候,要执行的委托调用,如 按下 home 按钮,返回主屏幕,或全屏之间切换应用程序等。
3、applicationDidEnterBackground:在应用程序已进入后台程序时,要执行的委托调用。
4、applicationWillEnterForeground:在应用程序将要进入前台时(被激活),要执行的委托调用,刚好与applicationWillResignActive 方法相对应。
5、applicationDidBecomeActive:在应用程序已被激活后,要执行的委托调用,刚好与applicationDidEnterBackground 方法相对应。
6、applicationWillTerminate:在应用程序要完全推出的时候,要执行的委托调用,这个需要要设置UIApplicationExitsOnSuspend的键值。
初次启动:
2013-05-24 20:20:31.550 LifeIOS[451:c07] iOS_didFinishLaunchingWithOptions
2013-05-24 20:20:31.551 LifeIOS[451:c07] iOS_applicationDidBecomeActive
按下home键:2013-05-24 20:22:17.349 LifeIOS[451:c07] iOS_applicationWillResignActive
2013-05-24 20:22:17.350 LifeIOS[451:c07] iOS_applicationDidEnterBackground
点击程序图标进入:2013-05-24 20:22:56.913 LifeIOS[451:c07] iOS_applicationWillEnterForeground
2013-05-24 20:22:56.914 LifeIOS[451:c07] iOS_applicationDidBecomeActive
- iOS应用程序生命周期各个函数方法详解
- IOS应用程序生命周期详解
- iOS 应用程序的生命周期详解
- ViewController生命周期的各个方法
- IOS 应用程序生命周期
- ios应用程序的生命周期
- IOS应用程序生命周期
- IOS应用程序生命周期图解
- IOS 应用程序生命周期
- ios应用程序的生命周期
- ios应用程序生命周期
- iOS应用程序生命周期
- IOS应用程序生命周期
- ios:应用程序生命周期
- IOS应用程序生命周期
- ios应用程序生命周期
- iOS应用程序生命周期问题
- iOS应用程序生命周期
- poj 2296 2-SAT(无矩形相交的最大边长)
- Porting WiFi drivers to Android
- 1050 moving table
- 有罪推定
- MySQL存储二进制数据
- iOS应用程序生命周期各个函数方法详解
- 和他人还让他好如同废物染发如果风王夫人个人各
- 【NOIP模拟】20140809 题解 & 总结
- 死亡游戏(链表)
- 大陆法
- 欢迎您在新浪博客安家
- 震惊世界!习总首次在公开场…
- 机房重构(4)——触发器的使用
- 看我驰骋4000米赛道