Experimenting with Timers
Experimenting with Timers
- Subject: Experimenting with Timers
- From: Isaac Sherman <email@hidden>
- Date: Sun, 21 Oct 2001 00:36:19 -0400
First off, I'd like to say thank you to everyone who has helped me out in
the past. Everything there is working fine. I have yet more questions, and
I'm sure this one won't be the last.
I'm working on setting up a timer, to update a text field every second with
the current date. That's pretty generic, so here is the specific code:
-(id) UpdateCurrentTime: (NSTimer) Timer
{
[CurrentTime setObjectValue: [NSCalendarDate date]];
return self;
}
- (IBAction)ASet:(id)sender
{
SEL UCT = @selector(UpdateCurrentTime:);
[NSTimer scheduledTimerWithTimeInterval:(NSTimeInterval)1 target:(id)nil
selector:(SEL)UCT userInfo:(id)nil repeats:(BOOL)YES];
[SetWindow showWindow:self];
[CurrentDate setObjectValue: [NSCalendarDate date]];
[CurrentTime setObjectValue: [NSCalendarDate date]];
}
The most annoying part is, I know I'm missing something obvious. I just
can't seem to put my finger on it, though. What I've tried to do is make a
method to update the text field, which would be called by the Timer every
second. I'm sure that my problem lays in the target and userInfo arguments,
or in a line I'm omitting somewhere.
Any ideas?
Thanks again!
--
Isaac Sherman
Charon Software (forthcoming)