What is event loop in ios life cycle and what is its usage and what it does?

后端 未结 1 1277
后悔当初
后悔当初 2021-02-20 14:25

I need to know what the event loop in the ios life cycle does?. Can any one suggest me regarding this??

1条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-20 15:15

    The best answer is probably the one provided by Apple in the "Main event loop" section of the Cocoa Application Competencies for iOS document.

    In the main event loop, an application continuously routes incoming events to objects for handling and, as a result of that handling, updates its appearance and state. An event loop is simply a run loop: an event-processing loop for scheduling work and coordinating the receipt of events from various input sources attached to the run loop. Every thread has access to a run loop. In all but the main thread, the run loop must be configured and run manually by your code. In Cocoa applications, the run loop for the main thread—the main event loop—is run automatically by the application object. What distinguishes the main event loop is that its primary input source receives events from the operating system that are generated by user actions—for example, tapping a view or entering text using a keyboard.

    Incidentally, if you're relatively new to iOS development, I'd really recommend a read of this document, as it'll answer a lot of questions you probably have.

    0 讨论(0)
提交回复
热议问题