NSRunLoop looping more than once?
NSRunLoop looping more than once?
- Subject: NSRunLoop looping more than once?
- From: John Anderson <email@hidden>
- Date: Wed, 12 Mar 2003 00:48:14 -0500
Dear List,
According to Apple's documention, calling runMode: beforeDate: on
NSRunLoop "runs the loop once" and "returns after ... the first input
is processed.
So with the following code:
myTimer = [NSTimer timerWithTimeInterval:timeInterval target:self
selector:@selector(myMethod) userInfo:nil repeats:YES];
[[NSRunLoop currentRunLoop] addTimer:myTimer
forMode:NSDefaultRunLoopMode];
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode
beforeDate:[NSDate distantFuture]];
I would expect to have "myMethod" called once when "myTimer" fires and
then control to passed on done the line.
However, this is not what happens. In fact, the NSRunLoop appears to
loop indefinitely and calls "myMethod" every time "myTimer" fires, as
if I had called run or runUntilDate: on it.
Is this supposed to happen?
If so, then what do "loop once" and "return after ... the first input
in processed" really mean?
Truly yours,
John Philip Anderson
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.