Possible Duplicate:
NSTimer doesn't stop
I hope to st开发者_高级运维op a running NSTimer, below are my codes:
timer=[[NSTimer scheduledTimerWithTimeInterval:10
target:self
selector:@selector(timerFired:)
userInfo:nil
repeats:NO] retain];
the function that stops the timer
-(void)stopTimer;
{
[timer invalidate];
[timer release];
timer = nil;
}
But I found that even I called 'stopTimer', the timer did not stop and 'timerFired' would be triggered.
Welcome any comment
Thanks
interdev
Don't retain it, don't release it.
精彩评论