我在使用 NSTimers 时遇到了很多麻烦。我以前用过它们,但这个计时器就是不想开火。
-(void) enqueueRecordingProcess
{
NSLog(@"made it!");
NSTimer *time2 = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(warnForRecording) userInfo:nil repeats:YES];
}
-(void) warnForRecording
{
NSLog(@"timer ticked!");
if (trv > 0) {
NSLog(@"Starting Recording in %i seconds.", trv);
}
}
我不明白为什么这不会运行。我什至试过这个:
- (void)enqueueRecordingProcess
{
NSLog(@"made it!");
[NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(warnForRecording) userInfo:nil repeats:YES];
}
- (void)warnForRecording
{
NSLog(@"timer ticked!");
}
怎么了?