Re: How to invalidate NSTimer
Re: How to invalidate NSTimer
- Subject: Re: How to invalidate NSTimer
- From: John Pannell <email@hidden>
- Date: Thu, 25 May 2006 22:33:58 -0600
Hi Aalok-
I can think of two possibilities:
1. Keep a reference to the timer you created (say as an ivar of an
object). Use the reference to invalidate the timer when desired.
2. Keep a flag variable somewhere to note if the timer should be
active (like a BOOL ivar of an object). In the method called by the
timer, check the flag and invalidate the timer if needed. The timer
is the argument to the called method.
HTH!
John
On May 25, 2006, at 10:20 PM, Aalok wrote:
Hi All,
I want to start timer to perform some specific task.
[NSTimer scheduledTimerWithTimeInterval:10.0
target:self
selector:@selector(handleTimerAction:)
userInfo:nil
repeats:YES];
This the function I am using. I want to invalidate this timer on some
user event (like disconnect.) Ånd want to start again when user
connects again.
I do not find any method to invalidate timer. I can not user
-invalidate as it is an instance method. and
scheduledTimerWithTimeInterval is a class method.
Please provide any help possible.
Regards,
Aalok
--
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40positivespinmedia.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden