Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 389
Monish Kumar Avatar asked Mar 23 '11 07:03

Monish Kumar


1 Answers

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.

like image 97
John Parker Avatar answered Oct 02 '22 00:10

John Parker