Re: Sheets and NSTimer
Re: Sheets and NSTimer
- Subject: Re: Sheets and NSTimer
- From: "b.bum" <email@hidden>
- Date: Sun, 22 Feb 2004 15:25:04 -0800
On Feb 22, 2004, at 1:01 PM, David Dauer wrote:
I've got a little problem using an NSTimer while running a sheet.
I tried to create the timer using
myTimer = [[NSTimer scheduledTimerWithTimeInterval:5.0 target:self
selector:@selector(myTimerAction:) userInfo:nil repeats:YES] retain];
after and before the beginSheet:... method.
The beginSheet: method is documented as ...
Starts a document modal session. The didEndSelector method is optional.
If implemented by the modalDelegate, this method is invoked after the
modal session has ended and is passed a return code and caller
specified in contextInfo. didEndSelector should have the following
signature:
.... whereas NSTimer's documentation is as follows...
There are three ways to create a timer. The
scheduledTimerWithTimeInterval:invocation:repeats: and
scheduledTimerWithTimeInterval:target:selector:userInfo:repeats: class
methods automatically register the new timer with the current NSRunLoop
object in the default mode (NSDefaultRunLoopMode).
... so, when the sheet starts, the run loop goes modal for that
particular window and the timer never fires. Try creating an
unscheduled timer and then add it to the run loop w/NSTimer's...
- (void)addTimer:(NSTimer *)timer forMode:(NSString *)mode;
At least, I believe that will work without having actually written a
line of code.
b.bum
_______________________________________________
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.