zoukankan      html  css  js  c++  java
  • 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. 

  • 相关阅读:
    GIS数据格式:Coverage
    GIS数据格式:Shapefile
    WMS
    openlayer调用geoserver发布的地图实现地图的基本功能
    OpenLayers 项目完整分析——(二)源代码总体结构分析
    geoserver扫盲 openlayers相关
    The connection to adb is down, and a severe error has occured
    Maven创建工程项目如何下载所需要的jar包
    转:Java学习路线图,专为新手定制的Java学习计划建议
    C# Lambda表达式使用累加器例子
  • 原文地址:https://www.cnblogs.com/feng9exe/p/8876884.html
Copyright © 2011-2022 走看看