我有NSTimer和動作它。但是我想在第一次5秒之後,第二次4秒之後打電話行動 ...。非相等scheduledTimerWithTimeInterval NSTimer Objective-C
_timepast = 6;
self.timer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(handleDelay) userInfo:nil repeats:YES];
-(void)handleDelay
{
_timepast = _timepast - 1;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(_timepast * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self handleTimer];
});
}
因此,這意味着你要反轉定時器,對不對? –
@HardikShah是的,沒錯。 –