#import "QFAppDelegate.h"

@implementation QFAppDelegate

//最后一个执行的初始化函数
//主要做一些启动之前的初始化操作
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSLog(@"didFinishLaunchingWithOptions"); //实例化窗口
//initWithFrame 初始化位置和大小
//[UIScreen mainScreen] 获取屏幕对象
//[[UIScreen mainScreen] bounds] 获取屏幕边界,包含起始位置和屏幕大小
//CGRect 矩形大小
//CGPoint 坐标位置
//CGSize 大小
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
//设置窗口背景颜色
//UIColor 颜色对象
self.window.backgroundColor = [UIColor whiteColor];
//自定义颜色 RGBa
//Red,Green,Blue 取值范围 0.0~1.0
//Aplha 取值范围 0.0~1.0 0 为不透明
UIColor *c = [UIColor colorWithRed:arc4random() % / 255.0
green:arc4random() % / 255.0
blue:arc4random() % / 255.0
alpha:1.0]; self.window.backgroundColor = c; //显示窗口
[self.window makeKeyAndVisible]; //UIView
//在屏幕上看得见摸得着的东西都是UIView的子类 return YES;
} //即将进入后台
//停止一些正在执行的操作
- (void)applicationWillResignActive:(UIApplication *)application
{
NSLog(@"applicationWillResignActive");
// 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.
} //已经进入后台
//尽量多的保存app的当前状态
- (void)applicationDidEnterBackground:(UIApplication *)application
{
NSLog(@"applicationDidEnterBackground");
// 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
{
NSLog(@"applicationWillEnterForeground");
// 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
{
NSLog(@"applicationDidBecomeActive");
// 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
{
NSLog(@"applicationWillTerminate");
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
} @end

一个UI程序开始的代码函数导读的更多相关文章

  1. UI基础:UI程序执行顺序(UIApplicationMain()函数),自定义视图 分类: iOS学习-UI 2015-07-02 22:09 68人阅读 评论(0) 收藏

    UI程序的一般执行顺序: 先进入main里面,执行函数UIApplicationMain(),通过该函数创建应用程序对象和指定其代理并实现监听,当执行函数UIApplicationMain()时还会做 ...

  2. 我的第一个Python程序,定义主函数,eval、format函数详解,

    程序实例: #第一个py小程序 def main(): f = eval(input("输入一个数值:")) p=f*(5/9) print("现在的值为:{0:3.3f ...

  3. Qt-第一个QML程序-2-关键代码分析,TEXT,Image,Mouseare

    qml语言开始写的时候有点不习惯,后面用的多了感觉很好,很顺手,用于快速搭建项目界面,真的很好. 目前用到的还是比较简单的 隐藏标题栏,而依附任务栏 flags: Qt.Window | Qt.Fra ...

  4. CodeGuide 300+文档、100+代码库,一个指导程序员写代码的,Github 仓库开源啦!

    作者:小傅哥 博客:https://bugstack.cn 沉淀.分享.成长,让自己和他人都能有所收获! 一.路怎样走,让你们自己挑 B站 视频:https://www.bilibili.com/vi ...

  5. 【C++探索之旅】第一部分第三课:第一个C++程序

    内容简介 1.第一部分第三课:第一个C++程序 2.第一部分第四课预告:内存的使用 第一个C++程序 经过上两课之后,我们已经知道了什么是编程,编程的语言,编程的必要软件,C++是什么,我们也安装了适 ...

  6. 三、第一个cocos2d程序的代码分析

    http://blog.csdn.net/q199109106q/article/details/8591706 在第一讲中已经新建了第一个cocos2d程序,运行效果如下: 在这讲中我们来分析下里面 ...

  7. 【C语言】03-第一个C程序代码分析

    前面我们已经创建了一个C程序,接下来分析一下里面的代码. 项目结构如下: 一.代码分析 打开项目中的main.c文件(C程序的源文件拓展名为.c),可以发现它是第一个C程序中的唯一一个源文件,代码如下 ...

  8. 【C语言】01-第一个c程序代码分析

    创建了一个C程序,接下来分析一下里面的代码. 项目结构如下: 一.代码分析 打开项目中的main.c文件(C程序的源文件拓展名为.c),可以发现它是第一个C程序中的唯一一个源文件,代码如下: 1 #i ...

  9. Python_代码练习_写一个判断是否为小数的函数

    这两天在学习函数,练习写一个判断是否为小数的函数,看起来蛮简单的,飞速写完很是得意,然后测了一下,发现差得好多呀,这个并不像想象那样简单,我得到的教训是,想要把一个需求哪怕再小的需求考虑周全,都不是件 ...

随机推荐

  1. 【dp】B-number

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3652 题解:先预处理([0,0][1,1],[2,2]....[0,9],[10, 19],[20,2 ...

  2. opencv随笔1

    图像处理技术一般包括图像压缩,增强和复原,匹配 描述和l识别 3 个部分. 图像处理一般指数字图像处理 ( Digitallmage Processing). 其中,数字图像是指用工业相机.摄像机.扫 ...

  3. Code Runner for VS Code 突破 1000 万下载量!支持运行超过 40 种语言

    记得三年多前,韩老师那时还在写 PHP(是的,没错!在微软写 PHP),同时需要写 Python 和 Node.js .所以在那时,支持多种语言的 VS Code 已经是笔者的主力编辑器了.唯一不足的 ...

  4. win10中java环境变量配置

    首先,应该安装jdk,jdk的安装一般是jdk8,一般情况下去官网下载,此处有jdk8的网盘链接: -- 在安装jdk时候,可以看下这篇jdk和jre区别的博客--,有助于理解两者的区别和联系. 接触 ...

  5. 排错:golang运行http服务器直接挂掉无错误提示

    一运行就退出一运行就退出,没有报错提示检查代码也没有问题. 代码也没问题,原来是端口被占用了,改成8888就正常了

  6. 【Linux系列】Centos 7部署Laravel项目(七)

    目的 本文主要介绍以下五点: 一. Composer安装 二. SSH设置 三. Git安装 四. Laravel部署 五. 上传GitHub 演示 一. Composer安装 # cd /usr/l ...

  7. Spring中常见的设计模式——工厂模式

    一.简单工厂模式 简单工厂模式(Simple Factory Pattern)由一个工厂对象决定创建哪一种产品类的实例,简单工厂模式适用于工厂类负责创建对象较少的情况,且客户端只需要传入工厂类的参数, ...

  8. 使用lib-flexible.js适配移动端UI设计750px设计图

    最近在和设计沟通关于设计图尺寸大小和前端实际页面尺寸大小不一致的情况,我们的UI设计是使用的iPone6的,(iphone6:    375px*667px  实际像素:750px*1334px)如果 ...

  9. linux网络配置(iproute2)

    iproute2家族 ip命令:show  / manipulate routing,devices,policy routing and tunnels(显示/操纵路由.设备.策略路由和隧道) 语法 ...

  10. 聚类-K-Means

    1.什么是K-Means? K均值算法聚类 关键词:K个种子,均值聚类的概念:一种无监督的学习,事先不知道类别,自动将相似的对象归到同一个簇中 K-Means算法是一种聚类分析(cluster ana ...