延迟操作
来源:互联网 发布:淘宝的主营业务 编辑:程序博客网 时间:2024/06/09 20:11
1. GCD 延迟5秒在主线程执行
(延迟5秒执行block里面的代码)
// 创建线程 time(第一个参数: 从现在开始, 第二个参数延迟的时间)
dispatch_time_t time = dispatch_time(DISPATCH_TIME_NOW, (int64_t)5.0 * NSEC_PER_SEC);
dispatch_after(time, dispatch_get_main_queue(), ^{
self.timer = [NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(nextPicture) userInfo:nil repeats:YES];
[self.timer fire];
});
2. 主线程延迟执行 5s
[NSThread sleepForTimeInterval:5];
3. self.tom这个对象 延迟self.tom.animationDuration 后 执行 setAnimationImages:这个方法
[self.tom performSelector:@selector(setAnimationImages:) withObject:nil afterDelay:self.tom.animationDuration]
0 0
- 延迟操作
- 延迟操作
- 内核延迟操作
- 常用知识点-延迟操作
- 多线程之延迟操作
- 安卓延迟操作
- Android延迟操作
- android 延迟操作
- 时间、延迟及延缓操作
- 时间,延迟及迟缓操作
- 时间、延迟及延缓操作
- 时间、延迟及延缓操作
- LDD操作延迟(延缓)
- iOS 开发中延迟操作
- 3种延迟操作 选择
- iOS 多线程之延迟操作
- inux驱动--时间、延迟及延缓操作
- 第七章:时间、延迟及延缓操作
- System V 信号灯
- JSON 入门
- iwi的模板
- Intellij idea 中 JUnit 的简单配置
- 求余数
- 延迟操作
- uva 11275 - 3D Triangles(几何)
- Android简单练习(TableLayout)
- intellij常用快捷键
- HDU 5423 Rikka with Tree(DFS)
- maven项目管理之-06-pom.xml说明
- java学习笔记--入门
- CSFB技术概述
- IT职场人生系列之四:怎样写简历