Re: extending tutorial for timer
Re: extending tutorial for timer
- Subject: Re: extending tutorial for timer
- From: Ondra Cada <email@hidden>
- Date: Sun, 28 Oct 2001 10:38:06 +0100
Howdy, Tom,
>
>>>>> Tomas Zahradnicky, Jr. (TZJ) wrote at Sun, 28 Oct 2001 00:33:41 +0200:
TZJ> ...update itself to contain the current time, but it is not clear to me
TZJ> how do I add the NSTimer object to the controller class. And the
TZJ> question is how do I create a timer which will send me a message
TZJ> which I turn into a NSTextField update message? and one more
TZJ> question. is there some method to tell the NSTimer to be released or
TZJ> just sending the release message to the timer will be sufficient?
I'm used to the older way of delayed message (which is, implementation-wise,
quite the same):
-(void)periodicalMethod {
... do anything here ...
if (CONTINUE)
[self performSelector:_cmd withObject:nil afterDelay:DELAY];
}
You should call the method once at start; while CONTINUE evaluates to YES,
it will be automatically called each DELAY seconds (for finer timing DELAY
can be non-integral, like 0.25 for a quarter of sec).
The NSTimer interface is slightly cleaner, and quite simple too, but I have
no time to search it in docs just now. But you need just to make a timer, and
give it
- the time interval;
- the selector of message to be sent;
- the object the message should be sent to;
and that's all. I *guess* release should be sufficient; besides, there is
some specific method -- again I don't remember the name, something like
'destroy' or so.
---
Ondra Cada
OCSoftware: email@hidden
http://www.ocs.cz
2K Development: email@hidden
http://www.2kdevelopment.cz
private email@hidden
http://www.ocs.cz/oc