zoukankan      html  css  js  c++  java
  • main Runloop

    1.An app’s main run loop processes all user-related events

    2.The UIApplication object sets up the main run loop at launch time and uses it to process events and handle updates to view-based interfaces.

    3. the main run loop executes on the app’s main thread

     

    过程:screen touch -->system -->through a special port set up by UIKit to app -->Events are queued internally by the app and dispatched one-by-one to the main run loop for execution.

    The UIApplication object is the first object to receive the event and make the decision about what needs to be done. 

    A touch event is usually dispatched to the main window object, which in turn dispatches it to the view in which the touch occurred. Other events might take slightly different paths through various app objects.

     事件类型:

    大多数事件使用main run loop,

    how to handle most types of events—including touch, remote control, motion, accelerometer, and gyroscopic events—see Event Handling Guide for iOS.

    Event type

    Delivered to…

    Notes

    Touch

    The view object in which the event occurred

    Views are responder objects. Any touch events not handled by the view are forwarded down the responder chain for processing.

    Remote control

    Shake motion events

    First responder object

    Remote control events are for controlling media playback and are generated by headphones and other accessories.

    Accelerometer

    Magnetometer

    Gyroscope

    The object you designate

    Events related to the accelerometer, magnetometer, and gyroscope hardware are delivered to the object you designate.

    Location

    The object you designate

    You register to receive location events using the Core Location framework. For more information about using Core Location, see Location and Maps Programming Guide.

    Redraw

    The view that needs the update

    Redraw events do not involve an event object but are simply calls to the view to draw itself. The drawing architecture for iOS is described in Drawing and Printing Guide for iOS.

    Some events, such as touch and remote control events, are handled by your app’s responder objects. Responder objects are everywhere in your app. (The UIApplication object, your view objects, and your view controller objects are all examples of responder objects.) Most events target a specific responder object but can be passed to other responder objects (via the responder chain) if needed to handle an event. For example, a view that does not handle an event can pass the event to its superview or to a view controller

     

    Touch events occurring in controls (such as buttons) are handled differently than touch events occurring in many other types of views. There are typically only a limited number of interactions possible with a control, and so those interactions are repackaged into action messages and delivered to an appropriate target object. This target-action design pattern makes it easy to use controls to trigger the execution of custom code in your app.

     

     

  • 相关阅读:
    Ubuntu 16.04 LTS nodejs+pm2+nginx+git 基础安装及配置环境(未完,未整理)
    JavaScript 二、eval 和 with 函数
    JavaScript 一、 ES6 声明变量,作用域理解
    UNMET PEER DEPENDENCY @angular/common@2.3.1
    Laravel Homestead 离线安装
    mac os x 记录 转载
    Ubuntu 16.04 LTS 完善解决亮度调整
    oh my zsh 切换 bash
    关于bitmap储存图片报内存不足的问题
    .net操作sqlserver数据库
  • 原文地址:https://www.cnblogs.com/cocoabanana/p/5547669.html
Copyright © 2011-2022 走看看