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

Monish Kumar picture Monish Kumar · Mar 23, 2011 · Viewed 7.1k times · Source

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

Answer

John Parker picture John Parker · Mar 23, 2011

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.