应用程序代理AppDelegate解析
应用程序UIApplication是通过代理和外部交互的,当应用程序生命周期中发生改变时UIApplication就会调用代理对应的方法。
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
//程序启动之后执行,只在第一次启动后执行,以后不再执行。
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.
}
- (void)applicationDidEnterBackground:(UIApplication *)application {
//程序进入后台后执行,注意进入后台时会先失去焦点再进入后台;
//分两种情况讨论:
//1,当你的应用程序不支持后台运行的时候,该函数的作用等同于applicationWillTerminate:,关闭应用程序之前调用,保存上下文环境,释放资源等。
//2,当应用程序支持后台运行时,该函数的作用是释放无用资源,保存上下文环境,以备应用程序由后台转入前台之后有足够的信息恢复到之前转入后台之前到状态。
// 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.
}
- (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.
}
- (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.
}
- (void)applicationWillTerminate:(UIApplication *)application {
//程序在终止时执行,包括正常终止或异常终止.
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
@end
应用程序代理AppDelegate解析的更多相关文章
- JDK的动态代理深入解析(Proxy,InvocationHandler)(转)
JDK的动态代理深入解析(Proxy,InvocationHandler)(转) 一.什么是动态代理 动态代理可以提供对另一个对象的访问,同时隐藏实际对象的具体事实.代理一般会实现它所表示的实际对象的 ...
- 控制台程序的参数解析类库 CommandLine
C#控制台程序的参数解析类库 CommandLine简单使用说明 前言 C#开发的控制台程序,默认接收string[] args参数.如果有多个参数需要输入时,可以按照顺序依次输入:但如果有些参数不是 ...
- [MapReduce_3] MapReduce 程序运行流程解析
0. 说明 Word Count 程序运行流程解析 && MapReduce 程序运行流程解析 1. Word Count 程序运行流程解析 2. MapReduce 程序运行流程图
- [微信小程序] 微信小程序获取用户定位信息并加载对应城市信息,wx.getLocation,腾讯地图小程序api,微信小程序经纬度逆解析地理信息
因为需要在小程序加个定位并加载对应城市信息 然而小程序自带api目前只能获取经纬度不能逆解析,虽然自己解析方式,但是同时也要调用地图,难道用户每次进小程序还要强行打开地图选择地址才定位吗?多麻烦也不利 ...
- 【h5标签转小程序标签】小程序使用wxParse解析html教程
一.先下载所需文件,下载地址:https://pan.baidu.com/s/1umZO9uI24zUTRd7VqaWbAg ,下载完毕后会得到一个wxParse文件夹,后面会用到: 二.先拷贝cs ...
- 微信小程序 使用wxParse解析html
微信小程序 加载 HTML 标签:https://blog.csdn.net/zclengendary/article/details/54312030 微信小程序 使用wxParse解析html:h ...
- Java动态代理深入解析
要想了解Java动态代理,首先要了解什么叫做代理,熟悉设计模式的朋友一定知道在Gof总结的23种设计模式中,有一种叫做代理(Proxy)的对象结构型模式,动态代理中的代理,指的就是这种设计模式. 在我 ...
- socks5代理原理解析
sock5代理的工作程序是: 1.需要代理方向服务器发出请求信息. 2.代理方应答 3.需要代理方接到应答后发送向代理方发送目的ip和端口 4.代理方与 ...
- Android开发之 Android应用程序目录结构解析
建立的HelloWorld的应用项目,其代码是由ADT插件自动生成的,形成Android项目特有的结构框架. 接下来让我带领大家解析一个Android程序的各个组成部分,这次我们拿一个Hello,Wo ...
随机推荐
- 检索 COM 类工厂中 CLSID 为 {13C28AD0-F195-4319-B7D7-A1BDAA329FB8} 的组件时失败,原因是出现以下错误: 80040154
异常类型:COMException 异常消息:检索 COM 类工厂中 CLSID 为 {13C28AD0-F195-4319-B7D7-A1BDAA329FB8} 的组件时失败,原因是出现以下错误: ...
- 个人对joomla3.2x和joomla2.5X浅薄看法
很久没有写joomla文章了,发现想写的东西还是挺多的,后面抽时间补回来,其实更多还是php的一些东西.joomla3.0以后系统改变挺大,后台都是用bootstrap作为主题,个人对这个无爱,因为他 ...
- [Math] Beating the binary search algorithm – interpolation search, galloping search
From: http://blog.jobbole.com/73517/ 二分检索是查找有序数组最简单然而最有效的算法之一.现在的问题是,更复杂的算法能不能做的更好?我们先看一下其他方法. 有些情况下 ...
- read和write函数
读函数read ssize_t read(int fd,void *buf,size_t nbyte) 如果是ECONNREST表示网络连接出了问题. 写函数write ssize_t writ ...
- Python单元测试框架之pytest---如何执行测试用例
介绍 pytest是一个成熟的全功能的Python测试工具,可以帮助你写出更好的程序. 适合从简单的单元到复杂的功能测试 l 模块化parametrizeable装置(在2.3,持续改进) l 参 ...
- 50款免费名片设计模板 PSD 源文件下载《上篇》
名片它可能是给你的客户留下正面的印象第一步,另一方面,名片是一个企业最重要和最符合成本效益的营销工具之一,尤其是对于刚刚起步的企业.这里收集了50款免费的名片设计模板,提供 PSD 源文件下载. 您可 ...
- python 在sublime 中的配置
首先可以先装package control 方法——按ctrl+`,然后在命令行里复制粘贴以下代码, import urllib2,os;pf='Package Control.sublime-pac ...
- 敏捷个人手机应用iOS和Android公开注册
敏捷个人手机应用iOS出炉了,现在免费公开注册,截止时间到4月20日,注册时的邀请码是7个字符: 1.admin Android下载地址:http://agileme-download.qiniudn ...
- 分享几个cocos2dx的小游戏
先上几个自己写的,因为最近要用cocos2dx,所以就边学边开发几个小游戏玩玩,有捕鱼,连连看,还有打地鼠!都不算完整的项目,不过拿来学习还是可以的,或者在基础上再二次开发,扩展自己! 1:捕鱼的 先 ...
- 自定义UICollectionViewController之后 如何设置UICollectionView的布局方式
我们很多时候使用UICollectionView 可能都是直接创建 UICollectionView 通过初始化的时候 传入一个布局对象的方式来使用UICollectionView 比如我们之前 ...