1.GCD的定时器声明属性时需要使用类型,无“*”号
@property (nonatomic,strong) dispatch_source_t timer;
其他操作
//定时器启动
dispatch_resume(timer);
//定时器挂起
dispatch_suspend(self.timer);
//定时器释放
dispatch_source_cancel(self.timer);
self.timer = nil;
注意:一定要保持对定时器的引用,否则,定时器就向一次后,就会被释放了
- 不再主线层中更新UI,UI更新的操作可能没有效果。












网友评论