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 ...
随机推荐
- SHell string操作 转
本文也即<Learning the bash Shell>3rd Edition的第四章Basic Shell Programming之读书笔记之二,但我们将不限于此. String操作 ...
- Sea.js创始人玉伯的前端开发之路
在Web应用程序的用户体验越来越被重视的今天,前端开发的地位也上升到了前所未有的高度,而随之而来的也有更多的挑战. 为了将前端开发者繁重的工作变得简单,框架应运而生.国内也不乏一些非常优秀的前端开发框 ...
- java实现吸血鬼数字
public class Vempire { public static void main(String[] arg) { String[] ar_str1, ar_str2; ; int from ...
- unauthenticated user reading from net
今天有台数据库异常,登录服务器后执行show processlist,发现大量的 unauthenticated user 状态.如下: 于是第一时间想到DNS反向解析的问题,于是看看是否关闭DNS解 ...
- 使用AuthDBMType指令支持多种类似DBM的数据库
Unix线程 在支持POSIX线程的Unix系统上,现在Apache能在混合的多进程.多线程模式下运行,使很多(但非全部)配置的可伸缩性得到了改善. 新的编译系统 重写了编译系统,现在是基于autoc ...
- [转]SEP 11.x 迁移
Sepm 迁移/灾难恢复 条件:更换服务器主机/重装服务器系统,但保持主机ip地址不更改,主机名不更改. 备份步骤: Login 服务器控制台,进入"管理员" ...
- 修改CSV中的某些值 -- 2
C:\aaa.csv "IPAddress","FullDomainName","RequestedTargetGroupName" &qu ...
- 《GK101任意波发生器》升级固件发布(版本:1.0.1build803)
一.固件说明: 硬件版本:0,logic.3 固件版本:1.0.1.build803 编译日期:2014-08-06 ====================================== 二. ...
- pox目录中的交换机mac地址学习模块 l2_multi源码
# Copyright 2012-2013 James McCauley # # Licensed under the Apache License, Version 2.0 (the "L ...
- Apache 配置 Basic 认证
/* * 环境:WAMP( Windows7 + WampServer2.2(Apache 2.2.21)) */ 配置过程: ① 生成用户文件,文件路径可以使用绝对路径,也可以使用相对路径 进入 a ...