美文网首页
2018-07-15

2018-07-15

作者: 幸福晓杰2016 | 来源:发表于2018-07-15 17:24 被阅读3次

1.GCD的定时器声明属性时需要使用类型,无“*”号

@property (nonatomic,strong) dispatch_source_t timer;

其他操作

//定时器启动
dispatch_resume(timer);

//定时器挂起
dispatch_suspend(self.timer);

//定时器释放
 dispatch_source_cancel(self.timer);
 self.timer = nil;

注意:一定要保持对定时器的引用,否则,定时器就向一次后,就会被释放了

  1. 不再主线层中更新UI,UI更新的操作可能没有效果。

相关文章

网友评论

      本文标题:2018-07-15

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