我正在使用这段代码:
timer = [NSTimer scheduledTimerWithTimeInterval:2
target:self
selector:@selector(update)
userInfo:nil
repeats:YES];
...
-(void)update {
NSDate *date = [NSDate date];
NSString *Currentdate = [date descriptionWithCalendarFormat:@"%b %d, %Y %I:%M:%S %p"
timeZone:nil
locale:nil];
lbl.text = Currentdate;
}
它工作正常,但我想在运行时将计时器间隔从 2 秒更改为 1 秒。我怎样才能做到这一点?
提前致谢。