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;












最后編輯于
?著作權歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內(nèi)容

  • 1.NSTimer的介紹 (1.)8種創(chuàng)建方法 <1> + (NSTimer *)timerWithTimeInt...
    liangZhen閱讀 7,698評論 0 6
  • 這有三個API都是新增的,標識有API_AVAILABLE(macosx(10.12), ios(10.0), w...
    yehkong閱讀 578評論 0 0
  • 定時器是什么? 定時器提供執(zhí)行延遲動作或周期性動作的方式。 定時器等待直到一定時間間隔過去,然后觸發(fā),向指定的對象...
    權宜平和閱讀 979評論 0 0
  • 一、初始化 (1)+ (NSTimer *)timerWithTimeInterval:(NSTimeInterv...
    Baby小豬閱讀 476評論 0 0
  • 春天的形容詞 春天的舞蹈從太陽開始,凡陽光所到之處,春回大地,萬物復蘇。(四年級 余龍飛) 春天的舞蹈從小草開始,...
    Fenny_官閱讀 464評論 0 3

友情鏈接更多精彩內(nèi)容