-5
以下是我的源代码,我不知道为什么。 谁能给我解释一下。感谢这么多NSTimer同时复制动作?
- (void)onTimer:(NSTimer *)timer {
long currentPlaybackTime = self.player.currentPlaybackTime;
int currentHours = (currentPlaybackTime/3600);
int currentMinutes = ((currentPlaybackTime/60) - currentHours*60);
int currentSeconds = (currentPlaybackTime % 60);
self.currentLabel.text = [NSString stringWithFormat:@"%i:%02d:%02d", currentHours, currentMinutes, currentSeconds];
if(currentMinutes > 0 && currentSeconds == 5)
{
//duplicate action at here.
NSLog(@"Make a thread to decrypt file buffer");
[self bufferEncryption];
}
}
呼叫计时器:
[NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(onTimer:) userInfo:nil repeats:YES];
当我尝试:
[NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(onTimer:) userInfo:nil repeats:NO];
定时器只调用一个round.Why?
问候,
你“不知道为什么”_什么? – 2012-03-26 02:20:23
也许OP不记得写它。他想知道它为什么存在:)。 – borrrden 2012-03-26 02:22:44
对不起,问题是,当第二个是5时,我有两个调试日志行。 NSLog(@“创建一个线程来解密文件缓冲区”); NSLog(@“Make a thread to decrypt file buffer”); – 2012-03-26 02:28:36