OC定时器

定时器方法

NSTimer * timer=[NSTimer timerWithTimeInterval:2.0 target:self selector:@selector(timgershijian) userInfo:nil repeats:YES];

NSRunLoop * run=[NSRunLoop currentRunLoop];

[run addTimer:timer forMode:NSRunLoopCommonModes];

延迟执行

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2*NSEC_PER_SEC)),dispatch_get_main_queue(), ^{

});

你可能感兴趣的:(OC定时器)