1.程序启动的过程
    .在桌面找到相应的应用的图标 点击图标
    .main函数

UIApplication类
Every app has exactly one instance of UIApplication
每个应用程序都只有一个UIApplication类的实例对象
运行起来的应用程序就是一个UIApplication对象。

UIApplicationMain
创建UIAppication对象的一个单例对象(singleton)

The role of your app’s application object
    .handle the initial routing of incoming user events
    处理用户行为的一个循环
    .dispatches action messages forwarded to it by control objects (instances of the UIControl class) to appropriate target objects.
    将特定的行为分配给特定的目标对象(将不同的事件传递给不同的UI控件)

Tasks
Getting the App Instance:获取单例对象
Getting the App Delegate:获取应用程序代理(捕获程序的状态)
Getting App Windows:获取窗口
Controlling and Handling Events:处理事件
Opening a URL Resource:打开外部的APP 资源(Safari)
Configuring the User Notification Setting:配置用户的通知
Registering for Remote Notifications:远程通知(QQ消息,更新通知)
Registering for Local Notifications:本地通知(闹钟)
Managing Background Execution:管理后台的执行
Managing Home Screen Quick Actions for 3D Touch:快捷方式
Controlling App Appearance:管理程序的外观(状态栏,网络指示,方向)

NSStringFromClass将一个类转化为字符串形式
NSStringFromClass([AppDelegate class])

UIApplicationDelegate
The UIApplicationDelegate protocol defines methods that are called by the singleton UIApplication object in response to important events in the lifetime of your app.
响应程序运行过程中发生的一些重要的事件(程序启动,进入后台,激活,内存吃紧。。)

The app delegate works alongside the app object to ensure your app interacts properly with the system and with other apps.
应用程序代理和app共同运行,确保程序与系统或者其他程序之间的交互

The app delegate is effectively the root object of your app. Like the UIApplication object itself, the app delegate is a singleton object and is always present at runtime.
应用程序代理是程序的root对象,整个程序运行过程中都一直存在

App Delegate里面的那些方法应该被实现
The app delegate performs several crucial roles:
        .It contains your app’s startup code.
        可以在代理里面使用代码进行设置
        a.程序加载起来调用的第一个方法(配置,注册服务器信息,读取数据,配置界面)
        //还没有运行到内存里面
        - (BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions:(nullable NSDictionary *)launchOptions NS_AVAILABLE_IOS(6_0);
        
        //加载好了,需要对显示的界面进行配置
        - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(nullable NSDictionary *)launchOptions NS_AVAILABLE_IOS(3_0);
        
        It responds to key changes in the state of your app. Specifically, it responds to both temporary interruptions and to changes in the execution state of your app, such as when your app transitions from the foreground to the background.
        临时打断、状态改变
        
        
        It responds to notifications originating from outside the app, such as remote notifications (also known as push notifications), low-memory warnings, download completion notifications, and more.
        外部通知(消息推送、内存不够、后台下载完成)
        registerForRemoteNotificationTypes:
        
        It determines whether state preservation and restoration should occur and assists in the preservation and restoration process as needed.
        确定程序的状态(数据)是否应该保存或者恢复
        
        It responds to events that target the app itself and are not specific to your app’s views or view controllers.
        响应应用程序本身的事件
        application:openURL:options:
        
        You can use it to store your app’s central data objects or any content that does not have an owning view controller.
        保存程序当前的核心数据或其他那些没有viewController保存的数据
    
UIResponder
The UIResponder class defines an interface for objects that respond to and handle events.
定义了对象响应和处理事件的接口
所有能够处理事件的UI控件都是直接或者间接继承于UIResponder

两种主要的事件行为:触摸事件和运动事件
There are two general kinds of events: touch events and motion events.
UIEvent
touchesBegan:withEvent:,
touchesMoved:withEvent:,
touchesEnded:withEvent:,
touchesCancelled:withEvent:.

motionBegan:withEvent:,
motionEnded:withEvent:,
 motionCancelled:withEvent:.
iOS3.0 canPerformAction:withSender:
iOS 4.0, UIResponder added the remoteControlReceivedWithEvent: method for handling remote-control events.

Responder Chain响应者链
辑视图有层级关系,后添加的视图会覆盖前面的视图,当一个事件发生了。最前面的视图会接收到这个事件,如果这个视图不响应,那么继续将事件传递给后面一层,直到UIWindow,如果都不响应,那么事件将会被丢弃,这个过程中,只要有一个响应了,那么这个事件就停止传递了。

为什么要使用代理
为了简化代码逻辑(苹果公司自己设计外观和系统,将制造、材料、销售代理出去,就是为了让自己专注核心模块)
继承可以完成代理的功能(如果使用继承,相当于苹果公司自己有自己的制造子公司,材料子公司,销售子公司,对于自己的管理加大了难度,并且无法专注核心竞争力)

整个应用程序只有一个代理(默认系统为我们提供了AppDelegate类)

UIWindow
manages and coordinates the views an app displays on a device screen
管理和协调设备屏幕上面显示的视图
一个应用程序一般情况下只有一个window

UIWindow的功能
    .provide an area for displaying its views
    提供一片用来显示视图的区域
    .distribute events to the views.
    分发事件给视图
    .一个UIWindow对象必须设置一个主界面
    设置窗口的rootViewController属性
    .显示窗口
    调用makeKeyAndVisible属性

UIScreen
    A UIScreen object defines the properties associated with a hardware-based display
    定义一些与基于硬件显示的属性

如何获取设备的主屏幕
    [UIScreen mainScreen]

如何获取一个视图的矩形坐标
    bounds属性

各种设配的尺寸:
    4(320 * 480)
    5(320 * 568)
     6(375 * 667)
     6p(414 * 736)

1230.2——iOS准备(阅读开发者文档时的笔记)的更多相关文章

  1. layuiAdmin pro v1.x 【单页版】开发者文档

    layuiAdmin std v1.x [iframe版]开发者文档 题外 该文档适用于 layuiAdmin 专业版(单页面),阅读之前请务必确认是否与你使用的版本对应. 熟练掌握 layuiAdm ...

  2. layuiAdmin std v1.x 【iframe版】开发者文档

    layuiAdmin pro v1.x [单页版]开发者文档 layuiAdmin.std(iframe 版) 是完全基于 layui 架构而成的通用型后台管理模板系统,采用传统的 iframe 多页 ...

  3. Typora+PicGo+cos图床打造开发者文档神器

    一.Typora简介 markdown简单.高效的语法,被每一个开发者所喜爱.Typora又是一款简约.强悍的实时渲染markdown编辑器.本文将介绍Typora搭配PicGo与腾讯cos对象存储( ...

  4. iOS Foundation 框架概述文档:常量、数据类型、框架、函数、公布声明

    iOS Foundation 框架概述文档:常量.数据类型.框架.函数.公布声明 太阳火神的漂亮人生 (http://blog.csdn.net/opengl_es) 本文遵循"署名-非商业 ...

  5. Emacs阅读chm文档

    .title { text-align: center; margin-bottom: .2em } .subtitle { text-align: center; font-size: medium ...

  6. 阅读MDN文档之CSS选择器介绍(一)

    本文为阅读MDN文档笔记 目录 Different types of Selectors Attribute Selectors Presence and value attribute select ...

  7. developers.google.com上的开发者文档如何切换显示语言

    一个小的tip,搜索到developers.google.com上的开发者文档,有些被翻译了的会自动显示中本版,如果想看英文版,可以在当前url后面加?hl=en,就会变成英文版.估计是根据地区直接推 ...

  8. 【swagger】1.swagger提供开发者文档--简单集成到spring boot中【spring mvc】【spring boot】

    swagger提供开发者文档 ======================================================== 作用:想使用swagger的同学,一定是想用它来做前后台 ...

  9. iOS AFNetWorking 下载pdf文档

    + (void)downLoadPdf:(NSString *)url pdf_id:(NSString *)pdf_id block:(APIFilePath)pdfFilePath {    NS ...

随机推荐

  1. iOS~~MD5加密

    // 一般加密 +(NSString *)md5String:(NSString *)str { const char *password=[str UTF8String]; unsigned cha ...

  2. 14 java 日期处理 joda-time

    http://www.joda.org/joda-time/ 任何企业应用程序都需要处理时间问题.应用程序需要知道当前的时间点和下一个时间点,有时它们还必须计算这两个时间点之间的路径.使用 JDK 完 ...

  3. 洛谷 P3383 【模板】线性筛素数

    P3383 [模板]线性筛素数 题目描述 如题,给定一个范围N,你需要处理M个某数字是否为质数的询问(每个数字均在范围1-N内) 输入输出格式 输入格式: 第一行包含两个正整数N.M,分别表示查询的范 ...

  4. redis数据结构与主要命令

    redis的数据类型有:string.hashes.lists.sets,sorted sets 1.string类型: set.get添加键值对获得键值对.如果多次赋值会覆盖掉原来的value se ...

  5. JSP学习笔记 - 源码 -- JSP Custom Tags -- JSP自定义标记

    NetBeans 项目demo下载地址>>  http://files.cnblogs.com/files/AndrewXu/JSPCustomTags.zip

  6. UIP协议栈

    UIP协议栈笔记 http://blog.chinaunix.net/uid-23247944-id-2974928.html

  7. CMS设计-组件化

    原来CMS使用的专题类的页面是 : 事先由前端写好完整页面,再交付给运营使用,这样使用的比较灵活,可以根据市场的不同需求由前端切出不同的页面,有时候一旦需求过多,就耽误切图的时间. 现在M和H5采用组 ...

  8. js+jquery+html实现在三种不通的情况下,点击图片放大的效果

    js+jquery+html实现在三种不通的情况下,点击图片放大的效果. 三种情况分别是:图片的父元素宽高固定;  图片的宽高固定;  图片的父元素宽固定,高度不固定 第一种情况:图片的父元素宽高固定 ...

  9. Jasper_table_resolve get multiple copies of table in detail band issue

    resolve method: (1) put table component into the Title band / Page Header band / Summary band, not i ...

  10. Android 操作手机内置存储卡中的文件

    场景:需要读取指定文件的内容,此文件是手动存储到手机内置存储卡中的,且手机上不存在SD卡. 对于android通过activity提供的openFileOutput和openFileInput可以直接 ...