iOS 应用程序的生命周期(转CocoaChina)

- - (BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions:(NSDictionary *)launchOptions
- {
- NSLog(@"①告诉代理进程启动但还没进入状态保存");
- return YES;
- }
- - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
- {
- self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
- NSLog(@"②告诉代理启动基本完成程序准备开始运行");
- // Override point for customization after application launch.
- self.window.backgroundColor = [UIColor whiteColor];
- [self.window makeKeyAndVisible];
- 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(@"③当应用程序将要入非活动状态执行,在此期间,应用程序不接收消息或事件,比如来电话");
- }
- - (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)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(@"⑤当程序被推送到后台的时候调用");
- [application beginBackgroundTaskWithExpirationHandler:^{
- NSLog(@"begin Background Task With Expiration Handler");
- }];
- }
- - (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)applicationWillTerminate:(UIApplication *)application
- {
- // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
- NSLog(@"⑦当程序将要退出是被调用");
- }
- - (void)applicationDidFinishLaunching:(UIApplication *)application
- {
- NSLog(@"⑧当程序载入后执行");
- }




- [application beginBackgroundTaskWithExpirationHandler:^{
- NSLog(@"begin Background Task With Expiration Handler");
- }];


iOS 应用程序的生命周期(转CocoaChina)的更多相关文章
- iOS 应用程序的生命周期
iOS 应用程序的生命周期(网络资源总结) http://blog.csdn.net/totogo2010/article/details/8048652 http://www.cocoachina. ...
- [转载] iOS应用程序的生命周期
iOS应用程序的生命周期 2015-06-23 iOS大全 (点击上方蓝字,快速关注我们) iOS应用程序一般都是由自己编写的代码和系统框架(system frameworks)组成,系统框架提供一些 ...
- [ios基础]IOS应用程序的生命周期问题
—程序的生命周期 a.程序的生命周期是指应用程序启动到应用程序结束整个阶段的全过程 b.每一个IOS应用程序都包含一个UIApplication对象,IOS系统通过该U ...
- 浅析 - iOS应用程序的生命周期
1.应用程序的状态 状态如下: Not running 未运行 程序没启动 Inactive 未激活 程序在前台运行,不过没有接收到事件.在没有事件处理情况下程序通 ...
- [转]iOS 应用程序的生命周期
OS的应用程序的生命周期,还有程序是运行在前台还是后台,应用程序各个状态的变换,这些对于开发者来说都是很重要的. iOS系统的资源是有限的,应用程序在前台和在后台的状态是不一样的.在后台时,程序会受到 ...
- iOS开发-程序的生命周期
为了更好的管理程序,了解程序的生命周期是很有必要的. 运行结果: 1.首次启动: 2015-05-26 17:33:28.362 Live[4858:214241] 程序开始 2015-05-26 1 ...
- iOS应用程序的生命周期
iOS应用程序一般都是由自己编写的代码和系统框架(system frameworks)组成,系统框架提供一些基本infrastructure给所有app来运行,而你提供自己编写的代码来定制app的外观 ...
- IOS学习1——IOS应用程序的生命周期及基本架构
一.应用程序的状态和多任务 有时系统会从app一种状态切换另一种状态来响应系统发生的事件.例如,当用户按下home键.电话打入.或其他中断发生时,当前运行的应用程序会切换状态来响应.应用程序的状态有以 ...
- 墓碑机制与 iOS 应用程序的生命周期
① 应用程序的状态 iOS 应用程序一共有 5 种状态: Not running:应用未运行 Inactive:应用运行在 foreground 但没有接收事件 Active:应用运行在 foregr ...
随机推荐
- JavaScript_解决safari浏览器window.open无法实现的问题
解决 safari window.open 无法实现的问题 先说下问题是什么吧: safari 中没办法在回调函数里面执行window.open, 原因是safari的安全机制将其阻挡了(具体的原因可 ...
- LeetCode-Sudoku Solver (递归解法)
题目地址: https://leetcode.com/problems/sudoku-solver/ // 将字符串的数独题转换成 int[9][9] ][], char ** b, int boar ...
- 那些年我们没能bypass的xss filter
个人很喜欢收集xss payload.在这里把自己平时挖xss时会用到的payloads列出来和大家一起分享.很希望大家能把自己的一些payload也分享出来.(由于 我是linux党,所以本文出现在 ...
- php 数组操作
<?php $vegetables[0] = "corn"; $vegetables[1] = "broccoli"; $vegetables[2] = ...
- JavaScript - 时间函数
时间美化函数 /* 1.< 60s, 显示为“刚刚” 2.>= 1min && < 60 min, 显示与当前时间差“XX分钟前” 3.>= 60min &am ...
- PHP文件漏桐可以通过对服务器进行设置和配置来达到防范目的
对脚本执行漏洞的防范 黑客利用脚本执行漏洞进行攻击的手段是多种多样的,而且是灵活多变的,对此,必须要采用多种防范方法综合的手段,才能有效防止黑客对脚本执行漏洞进行攻击.这里常用的方法方法有以下四种.一 ...
- Java垃圾收集机制
通常,我们把分配出去后,却无法回收的内存空间称为"内存渗漏体(Memory Leaks)". 以上这种程序设计的潜在危险 性在Java这样以严谨.安全著称的语言中是不允许的.但是J ...
- Java表单类双击提交
双击制御 有些时候一些操作会非常的耗费时间(Long Lived Operation),例如这个数据库的导出,表表生成等.有些时候程序的使用者看到很长时间服务器 没有反应,倾向于多次点击提交按钮.这样 ...
- 嵌入式 如何定位死循环或高CPU使用率(linux) 及性能优化
嵌入式 如何定位死循环或高CPU使用率(linux) ln -s /mnt/nfs/_install/usr/bin/sort /usr/bin/sort awk '{print $1,$2,$14, ...
- ExtJS笔记2 Class System
For the first time in its history, Ext JS went through a huge refactoring from the ground up with th ...