当您使计时器无效时,请将其设置为nil。然后你就可以将它指向一个新NSTimer对象。
例子:
//When you're done using your timer
[timer invalidate];
timer = nil;
//When you want to use it again
timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(tick) userInfo:nil repeats:TRUE];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2584 次 |
| 最近记录: |