iOS face Test 12-runloop is what. Runloop is literally the meaning of running loops, which is not bad, it is indeed a concept of the loop, or exactly the loop in the thread. Some programs are a circle, this circle is essentially the so-called runloop, is a cycle, but this cycle to add a lot of features.
First of all, the beginning of the loop body needs to detect whether there is a need to deal with the event, if there is to deal with, if not then go to sleep to save CPU time.
The Run loop is equivalent to the Win32 message loop mechanism, which lets you schedule whether a thread is busy or idle based on event/message (mouse, keyboard, timer, etc.).
The system automatically mechanical engineer the application's main line into a corresponding run loop to handle its message loop.
The ability to fire touchesbegan/touchesmoved and so on when touching uiview is invoked,
This is because the main thread of the application has such a run loop in the Uiapplicationmain to distribute input or timer events.
Reference article: Automatic release pools (Autorelease pool) and Runloop
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.