开发者

can not stop NSTimer [duplicate]

This question already has answers here: Closed 10 years ago.

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜