1,延时执行(不可重复)

效果我直接截取控制台的日志了,就不做UI了。

2,用NSTimer执行定时和延时(可重复)

[objc] view plain copy

/**
** timer 可重复
**/
- (void)timerMethodB
{
_timer = [NSTimer scheduledTimerWithTimeInterval:1.0f //间隔时间
target:self
selector:@selector(methodBEvnet)
userInfo:nil
repeats:YES];
} - (void)methodBEvnet
{
count++;
NSLog(@"-- Method_B count: %d", count); if (count >= ) {
[_timer invalidate]; //重复5次,timer停止
NSLog(@"-- end");
}
}

3,用dispatch_source_set_timer执行定时(可重复)

4,用dispatch_after执行延时(不可重复)

文章最后奉上demo

http://download.csdn.net/detail/xiongbaoxr/9417374

最新文章

  1. 导入 cocoapods引入的第三方库头文件,提示找不到
  2. vs2010中的MSBuild输出warning MSB8012问题
  3. iOS开发-图片高斯模糊效果
  4. Stationary point
  5. ext 3.2 tree 在IE10中点击事件失效的bug
  6. Macbook之设置Finder显示文件完整路径
  7. [读书笔记]了不起的node.js+实践(一)
  8. onbeforeunload、beforeunload
  9. 金蝶K3无法创建数据库,请查看该文件夹的错误的解决方法。
  10. unity 退到桌面的 OnApplicationPause
  11. UVA 10759 Dice Throwing
  12. Leetcode题解(十一)
  13. Angular之ngRoute与uiRoute
  14. 记录Linux CentOS 7系统完整部署Docker容器环境教程
  15. java课程之团队开发冲刺1.1
  16. MySql cmd下的学习笔记 —— 有关修饰器的知识(trigger)
  17. XE5开发Android程序调用电话相关功能(短信息和电话)
  18. CGLib缺少jar出现 java.lang.ClassNotFoundException: org.objectweb.asm.Type
  19. Spring-IOC bean 创建过程中的 ObjectFactory
  20. P1414 又是毕业季II

热门文章

  1. STL笔记(こ)--删除数组中重复元素
  2. Q&A - ABTesting是啥?
  3. k8s的ingress资源简述
  4. Python导入模块方法
  5. 19.VUE学习之- v-for与computed结合功能 筛选实例讲解
  6. HDU:2594-Simpsons’ Hidden Talents
  7. 笔记-python-selenium,phantomjs
  8. 使用python实现简单爬虫
  9. HDU 3848 CC On The Tree 树形DP
  10. 【网易严选】iOS持续集成打包(Jenkins+fastlane+nginx)