nsrunloop与模式
scrollview的模式切换;退出原来的模式使用新模式。
2018-04-18 18:16:41.208113+0800 CEMonitor[5014:410604] kCFRunLoopDefaultMode
2018-04-18 18:16:41.208395+0800 CEMonitor[5014:410604] kCFRunLoopDefaultMode
2018-04-18 18:16:41.208638+0800 CEMonitor[5014:410604] kCFRunLoopDefaultMode
2018-04-18 18:16:41.209857+0800 CEMonitor[5014:410604] run loop exit
2018-04-18 18:16:41.209986+0800 CEMonitor[5014:410604] kCFRunLoopDefaultMode
2018-04-18 18:16:41.210249+0800 CEMonitor[5014:410604] run loop entry
2018-04-18 18:16:41.210629+0800 CEMonitor[5014:410604] UITrackingRunLoopMode
2018-04-18 18:16:41.210832+0800 CEMonitor[5014:410604] UITrackingRunLoopMode
Run Loop Modes
A run loop mode is a collection of input sources and timers to be monitored and a collection of run loop observers to be notified. Each time you run your run loop, you specify (either explicitly or implicitly) a particular “mode” in which to run. During that pass of the run loop, only sources associated with that mode are monitored and allowed to deliver their events. (Similarly, only observers associated with that mode are notified of the run loop’s progress.) Sources associated with other modes hold on to any new events until subsequent passes through the loop in the appropriate mode.
In your code, you identify modes by name. Both Cocoa and Core Foundation define a default mode and several commonly used modes, along with strings for specifying those modes in your code. You can define custom modes by simply specifying a custom string for the mode name. Although the names you assign to custom modes are arbitrary, the contents of those modes are not. You must be sure to add one or more input sources, timers, or run-loop observers to any modes you create for them to be useful.
You use modes to filter out events from unwanted sources during a particular pass through your run loop. Most of the time, you will want to run your run loop in the system-defined “default” mode. A modal panel, however, might run in the “modal” mode. While in this mode, only sources relevant to the modal panel would deliver events to the thread. For secondary threads, you might use custom modes to prevent low-priority sources from delivering events during time-critical operations.
Note: Modes discriminate based on the source of the event, not the type of the event. For example, you would not use modes to match only mouse-down events or only keyboard events. You could use modes to listen to a different set of ports, suspend timers temporarily, or otherwise change the sources and run loop observers currently being monitored.
nsrunloop与模式的更多相关文章
- ios总结2018
1.为什么说Objective-C是一门动态的语言? 1.object-c类的类型和数据变量的类型都是在运行是确定的,而不是在编译时确定.例如:多态特性,我们可以使用父类指针来指向子类对象,并且可 ...
- runtime和runloop问答
Runtime 01 问题: objc在向一个对象发送消息时,发生了什么? 解答: 根据对象的 isa 指针找到类对象 id,在查询类对象里面的 methodLists 方法函数列表,如果没有在好到, ...
- Cocoa深入学习:NSOperationQueue、NSRunLoop和线程安全 (转)
目前在 iOS 和 OS X 中有两套先进的同步 API 可供我们使用:NSOperation 和 GCD .其中 GCD 是基于 C 的底层的 API ,而 NSOperation 则是 GCD 实 ...
- NSRunLoop
1.什么是RunLoop 运行循环 一个线程对应一个RunLoop,主线程的RunLoop默认已经启动,子线程的RunLoop得手动启动(调用run方法) RunLoop只能选择一个Mode启动,如果 ...
- NSRunLoop的进一步理解
iPhone应用开发中关于NSRunLoop的概述是本文要介绍的内容,NSRunLoop是一种更加高明的消息处理模式,他就高明在对消息处理过程进行了更好的抽象和封装,这样才能是的你不用处理一些很琐碎很 ...
- [iOS]浅谈NSRunloop工作原理和相关应用
一. 认识NSRunloop 1.1 NSRunloop与程序运行 那么具体什么是NSRunLoop呢?其实NSRunLoop的本质是一个消息机制的处理模式.让我们首先来看一下程序的入口——main ...
- NSRunLoop详解
1.NSRunLoop是IOS消息机制的处理模式 NSRunLoop的主要作用:控制NSRunLoop里面线程的执行和休眠,在有事情做的时候使当前NSRunLoop控制的线程工作,没有事情做让当前NS ...
- NSRunLoop && NSTimer
新的一年的开始,希望大家一切越来越好,越来越开心快乐!!! 定时器及运行循环 NSRunLoop是iOS消息机制的处理模式 NSRunLoop的主要作用:控制NSRunLoop里面线程的执行和休眠,在 ...
- NSRunLoop 概述和原理
NSRunLoop 概述和原理 1.什么是NSRunLoop? 我们会经常看到这样的代码: - (IBAction)start:(id)sender { pageStillLoading = YES; ...
随机推荐
- The features of Swift
The features of Swift are designed to work together to create a language that is powerful, yet fun t ...
- C# 获得指定路径扩展名 , 去除扩展名
//指定扩展名的文件 private void button1_Click(object sender, EventArgs e) { textBox1.Text = ""; st ...
- 应用二:Vue之ElementUI Form表单校验
(注:本文适用于有一定Vue基础或开发经验的读者,文章就知识点的讲解不一定全面,但却是开发过程中很实用的) 表单校验是前端开发过程中最常用到的功能之一,根据个人的工作经验总结在此对表单校验功能的基 ...
- 【转】【Oracle 集群】ORACLE DATABASE 11G RAC 知识图文详细教程之RAC 工作原理和相关组件(三)
原文地址:http://www.cnblogs.com/baiboy/p/orc3.html 阅读目录 目录 RAC 工作原理和相关组件 ClusterWare 架构 RAC 软件结构 集群注册(OC ...
- json字符串通俗的介绍
json 的本质就是字符串,按key:value这种键值对的格式定义的字符串 json就是传递javascript对象的语法,json只有两种结构,对象和数组,这两种结构嵌套和组合,来表示各种各样的数 ...
- redis 对 key 的操作
keys * :查询当前库中所有的 key keys k? :问号是占位符 del key :删除指定的 key exists k1 :判断 k1 是否存在 move k1 2 :(剪切) 将 k1 ...
- [Beginning SharePoint Designer 2010]Chapter2 编辑页面
本章概要: 1.如何展开隐藏任务面板和ribbon标签 2.页面编辑模式 3.代码视图模式和智能提示 4.如何组合SharePoint和页面上其他元素
- poj 3356
Description Let x and y be two strings over some finite alphabet A. We would like to transform x int ...
- spark视频教程免费下载
下载地址:点我下载 其它章节陆续上传中,Hadoop视频教程正在整理中,敬请关注.
- 从零单排入门机器学习:线性回归(linear regression)实践篇
线性回归(linear regression)实践篇 之前一段时间在coursera看了Andrew ng的机器学习的课程,感觉还不错,算是入门了. 这次打算以该课程的作业为主线,对机器学习基本知识做 ...