Stopping an NSTimer
Hi I am trying to stop an NSTimer by using "invalidate" however from
everything that I have tried I cant seem to get the timer to stop. Here is
the code that I have to make this work. I am trying to stop the timer from
a different class.
My Timer
_tripTimer = [NSTimer scheduledTimerWithTimeInterval:1.0
target:self
selector:@selector(updateTimerLabel:)
userInfo:[NSDate date]
repeats:YES];
which is synthesized and is strong
and the stopping method:
-(void)stopTimer
{
[_tripTimer invalidate];
}
and in my other class to get it to stop I am doing this:
[_carTripViewController stopTimer];
however that is not working. It is performing the method but not stopping
the timer. Im not sure if i am creating a new instance and that is why it
is not working. How can I get it to invalidate from another class?
Thank you! I am fairly new to objective-c and not sure how to access it
No comments:
Post a Comment