简要区别:NSTimer初始化器接受调用方法逻辑之间的间隔作为它的其中一个参数,预设一秒执行30次。CADisplayLink默认每秒运行60次,通过它的frameInterval属性改变每秒运行帧数,如设置为2,意味CADisplayLink每隔一帧运行一次,有效的逻辑每秒运行30次。此外,NST...
分类:
其他好文 时间:
2015-10-27 19:07:27
阅读次数:
169
起始偏移量设置为一个宽度 [NSTimer scheduledTimerWithTimeInterval:2 target:self selector:@selector(refreshPic) userInfo:nil repeats:YES];//定时器实现- (void)refreshP...
分类:
其他好文 时间:
2015-10-26 22:08:53
阅读次数:
201
方法1:使用NSTimer来实现主要使用的是NSTimer的scheduledTimerWithTimeInterval方法来每1秒执行一次timeFireMethod函数,timeFireMethod进行倒计时的一些操作,完成时把timer给invalidate掉就ok了,代码如下:seconds...
分类:
移动开发 时间:
2015-10-24 11:22:23
阅读次数:
151
//TimeInterval 时间间隔 //target 目标 //selector target 要执行 selector 方法 //userInfo 用户信息 //repeats 是否反复定时执行NSTimer *timer= [NSTimer scheduledT...
分类:
其他好文 时间:
2015-10-21 22:25:15
阅读次数:
171
问题:假如:需要按顺序执行两个动画A、B,B动画需要在A动画执行完毕后再执行。两个动画的执行不能有时间间隔,即A动画执行完毕立即执行B动画。实现方案:事先已经导入了Facebook的pop框架,并#import 1.设置A动画的动画时间,执行A动画2.创建NSTimer定时器timer,设置时间间隔...
分类:
其他好文 时间:
2015-10-18 21:14:35
阅读次数:
158
//方法一: //创建定时器 NSTimer *timer=[NSTimer timerWithTimeInterval:2.0 target:self selector:@selector(nextCilcked) userInfo:nil repeats:YES]; //利用消息循环来开启定时器...
分类:
其他好文 时间:
2015-10-18 20:03:57
阅读次数:
243
iOS的多线程,涉及到如下一些类,这里集中做个介绍,免得混淆。1、NSTimer很显然,这是定时器类2、NSTaskiOS 不支持 NSTask在很多并发操作的时候,多线程太耗资源,也太危险,这时候多进程出来了,通过 NSTask 可调用外部可执行程序3、NSThreadiOS 支持多个层次的多线程...
分类:
移动开发 时间:
2015-10-13 22:50:15
阅读次数:
237
一、iOS9中UIAlertController的简单使用 很明显,简单的UIAlertView已经不能用了,我感觉很伤心。 // 创建 UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"开始了" ...
分类:
移动开发 时间:
2015-10-03 18:13:40
阅读次数:
479
创建一个 Timer+ scheduledTimerWithTimeInterval: invocation: repeats:+ (NSTimer *)scheduledTimerWithTimeInterval:(NSTimeInterval)ti invocation:(NSInvocatio...
分类:
其他好文 时间:
2015-09-29 23:28:56
阅读次数:
240
使用NSTimer的类#import "TBTimerTestObject.h"#import "TBWeakTimerTarget.h"@interface TBTimerTestObject()@property (nonatomic, weak) NSTimer *timer;@end@imp...
分类:
移动开发 时间:
2015-09-29 18:23:21
阅读次数:
308