• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Experimenting with Timers
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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)


  • Follow-Ups:
    • Re: Experimenting with Timers
      • From: Angela Brett <email@hidden>
  • Prev by Date: Syntax coloring a NSTextView
  • Next by Date: Re: Submenu name...
  • Previous by thread: Re: Syntax coloring a NSTextView
  • Next by thread: Re: Experimenting with Timers
  • Index(es):
    • Date
    • Thread