NSTimer

NSTimer 库介绍

- + (NSTimer *)timerWithTimeInterval:(NSTimeInterval)ti invocation:(NSInvocation *)invocation repeats:(BOOL)yesOrNo;
- + (NSTimer *)scheduledTimerWithTimeInterval:(NSTimeInterval)ti invocation:(NSInvocation *)invocation repeats:(BOOL)yesOrNo;//
- + (NSTimer *)timerWithTimeInterval:(NSTimeInterval)ti target:(id)aTarget selector:(SEL)aSelector userInfo:(nullable id)userInfo repeats:(BOOL)yesOrNo;////初始化需要手动加入Runloop中
- + (NSTimer *)scheduledTimerWithTimeInterval:(NSTimeInterval)ti target:(id)aTarget selector:(SEL)aSelector userInfo:(nullable id)userInfo repeats:(BOOL)yesOrNo;//会自动把timer加入MainRunloop的NSDefaultRunLoopMode中
- + (NSTimer *)timerWithTimeInterval:(NSTimeInterval)interval repeats:(BOOL)repeats block:(void (^)(NSTimer *timer))block API_AVAILABLE(macosx(10.12), ios(10.0), watchos(3.0), tvos(10.0));
- + (NSTimer *)scheduledTimerWithTimeInterval:(NSTimeInterval)interval repeats:(BOOL)repeats block:(void (^)(NSTimer *timer))block API_AVAILABLE(macosx(10.12), ios(10.0), watchos(3.0), tvos(10.0));
- - (instancetype)initWithFireDate:(NSDate *)date interval:(NSTimeInterval)interval repeats:(BOOL)repeats block:(void (^)(NSTimer *timer))block API_AVAILABLE(macosx(10.12), ios(10.0), watchos(3.0), tvos(10.0));
- - (instancetype)initWithFireDate:(NSDate *)date interval:(NSTimeInterval)ti target:(id)t selector:(SEL)s userInfo:(nullable id)ui repeats:(BOOL)rep NS_DESIGNATED_INITIALIZER;
- - (void)fire;
- @property (copy) NSDate *fireDate;
- @property (readonly) NSTimeInterval timeInterval;
- - (void)invalidate;
- @property (readonly, getter=isValid) BOOL valid;
- @property (nullable, readonly, retain) id userInfo;












最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • 1.NSTimer的介绍 (1.)8种创建方法 <1> + (NSTimer *)timerWithTimeInt...
    liangZhen阅读 12,200评论 0 6
  • 这有三个API都是新增的,标识有API_AVAILABLE(macosx(10.12), ios(10.0), w...
    yehkong阅读 3,561评论 0 0
  • 定时器是什么? 定时器提供执行延迟动作或周期性动作的方式。 定时器等待直到一定时间间隔过去,然后触发,向指定的对象...
    权宜平和阅读 4,434评论 0 0
  • 一、初始化 (1)+ (NSTimer *)timerWithTimeInterval:(NSTimeInterv...
    Baby小猪阅读 3,142评论 0 0
  • 春天的形容词 春天的舞蹈从太阳开始,凡阳光所到之处,春回大地,万物复苏。(四年级 余龙飞) 春天的舞蹈从小草开始,...
    Fenny_官阅读 3,073评论 0 3

友情链接更多精彩内容