苹果的定时器通常有两种:NSTimer和CADisplayLink
NSTimer用于计时精度不高的地方
[NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(setNeedsDisplay) userInfo:nil repeats:YES];
CADisplayLink用于计时精度较高,而且涉及屏幕动画流畅刷新的地方
// iphone每秒刷新60次
// 屏幕刷新的时候就会触发
CADisplayLink *link = [CADisplayLink displayLinkWithTarget:self selector:@selector(setNeedsDisplay)];
[link addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSDefaultRunLoopMode];
找到一篇更加详细的文章,请参考:
http://www.jianshu.com/p/21d351116587