//初始化使用定時器
CADisplayLink *link = [CADisplayLink displayLinkWithTarget:self selector:@selector(test)];
//設置時間間隔(CADisplayLink 默認每秒運行60次)該屬性設置偉60代碼1s
link.frameInterval = 60.0;
[link addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSDefaultRunLoopMode];
//定時器暫停
ink.paused = YES;
//定時器繼續(xù)
link.paused = NO;
//定時器銷毀
[link invalidate];
NSTimer使用
NSTimer *timer = [NSTimer timerWithTimeInterval:2.0 target:self selector:@selector(方法名) userInfo:nil repeats:YES];
NSRunLoop *runLoop = [NSRunLoop mainRunLoop];
[runLoop addTimer:timer forMode:NSRunLoopCommonModes];