标签:
(3) 计时器NSTimer
+ (NSTimer *)scheduledTimerWithTimeInterval:(NSTimeInterval)ti target:(id)aTarget selector:(SEL)aSelector userInfo:(id)userInfo repeats:(BOOL)yesOrNo;
- (NSDate *)fireDate; 获得计时器开始时间
- (void)invalidate; 关闭计时器
//timerWithTimeInterval创建的timer需要添加到主线程中才能执行
self.timer = [NSTimer timerWithTimeInterval:1.5 target:self selector:@selector(nextImage) userInfo:nil repeats:YES];
[[NSRunLoop mainRunLoop] addTimer:self.timer forMode:NSRunLoopCommonModes];
self.timer = [NSTimer scheduledTimerWithTimeInterval:1.5 target:self
selector:@selector(nextImage) userInfo:nil repeats:YES];
[self.timer invalidate];
self.timer = nil;
标签:
原文地址:http://www.cnblogs.com/linxiu-0925/p/5058179.html