美文网首页
GCD定时器

GCD定时器

作者: 开发界小学生 | 来源:发表于2018-09-11 18:24 被阅读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);

相关文章

网友评论

      本文标题:GCD定时器

      本文链接:https://www.haomeiwen.com/subject/ewgugftx.html