• 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.

     

     

  • 相关阅读:
    MongoDB 启动和关闭
    java protostuff 序列化反序列化工具
    第一天
    第六章
    第六章
    第六章
    第六章
    第五章---面向对象---1.软件开发/2.异常处理/3.try...except的详细用法
    第五章-面向对象-1.元类介绍/2.自定义元类控制类的行为/3.控制类的实例化行为/4.控制类的实例化行为的应用
    第五章---面向对象---1.绑定方法与非绑定方法介绍/2.绑定方法与非绑定方法应用/3.反射/4.内置方法
  • 原文地址:https://www.cnblogs.com/cocoabanana/p/5547669.html
Copyright © 2020-2023  润新知