• 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

    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. 

  • 相关阅读:
    【底层原理】四位计算机的原理及其实现
    ctags的如何生成tags文件
    nginx-1.12.0版本(编译安装)-自定义安装路径
    使用LVS实现负载均衡原理及安装配置详解
    【系统架构】亿级Web系统搭建(1):Web负载均衡
    9个Linux系统常用监控命令
    NetStat命令详解
    SQLSERVER CXPACKET 等待
    什么是PAGELATCH和PAGEIOLATCH
    CentOS环境变量配置并生效
  • 原文地址:https://www.cnblogs.com/feng9exe/p/8876884.html
Copyright © 2020-2023  润新知