Quote:
Originally Posted by JasonR
The main thread of any iPhone app has something called a RunLoop that is managing a queue of events. If your loop is run of an NSTimer, which is common, the timer event is one of the things placed in the queue. Touch events are also placed in the queue, and called whenever they move to the top of the queue.
So after 1 frame of your loop is called, the RunLoop calls any touch or other events that have happened while your loop was running. Then, when all those are done, the next frame of your loop is called, and so on.
Is that what you were looking for?
|
Yes. Thank you.
I use displayLink like below:
CADisplayLink *displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(update)];
[displayLink setFrameInterval:nil];
[displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
So when an event occurs, it adds to the main application loop which then late called when "one frame" is moved right?
I'd like to visualize my understand. Please correct me if I'm wrong:
RunLoop (Main App) = what happens in ONE FRAME
{
events (including touch) -> allSortOfPotentialThingsImNotAwareOf -> displayLink -> repeat
}