IOS6学习笔记(四)
生活随笔
收集整理的這篇文章主要介紹了
IOS6学习笔记(四)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1.GCD設置一個timer計時器
- (void)awakeFromNib {
? __weak id weakSelf = self;
? double delayInSeconds = 0.25;
? _timer =?dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0,dispatch_get_main_queue());
? dispatch_source_set_timer(_timer, dispatch_walltime(NULL, 0),(unsigned)(delayInSeconds * NSEC_PER_SEC), 0);
? dispatch_source_set_event_handler(_timer, ^{
? ? [weakSelf updateValues];
? });
? dispatch_resume(_timer);
}
- (void)updateValues {
}
- (void)dealloc {
? dispatch_source_cancel(_timer);
}
轉載于:https://www.cnblogs.com/jay-dong/p/3296540.html
總結
以上是生活随笔為你收集整理的IOS6学习笔记(四)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 软件项目经理需具备什么样的技术水平?
- 下一篇: 死锁产生的条件+排除死锁的方法