GCD定时器

2018-09-11  本文已影响0人  开发界小学生

GCD定时器的使用

self.timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue);
dispatch_source_set_timer(self.timer, DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC, 1 * NSEC_PER_SEC);
dispatch_source_set_event_handler(self.timer, ^{
NSLog(@"---我是循环");
});
dispatch_resume(self.timer);

上一篇 下一篇

猜你喜欢

热点阅读