FWTimerClassWrapper
@interface FWTimerClassWrapper : FWClassWrapper
Undocumented
-
创建NSTimer,使用target-action,自动CommonModes添加到当前的运行循环中,避免ScrollView滚动时不触发
Declaration
Objective-C
- (nonnull NSTimer *)commonTimerWithTimeInterval:(NSTimeInterval)seconds target:(nonnull id)target selector:(nonnull SEL)selector userInfo:(nullable id)userInfo repeats:(BOOL)repeats;
Parameters
seconds
时间
target
目标
selector
方法
userInfo
参数
repeats
是否重复
Return Value
定时器
-
创建NSTimer,使用block,自动CommonModes添加到当前的运行循环中,避免ScrollView滚动时不触发
Declaration
Objective-C
- (nonnull NSTimer *) commonTimerWithTimeInterval:(NSTimeInterval)seconds block:(nonnull void (^)(NSTimer *_Nonnull))block repeats:(BOOL)repeats;
Parameters
seconds
时间
block
代码块
repeats
是否重复
Return Value
定时器
-
创建倒计时定时器
Declaration
Objective-C
- (nonnull NSTimer *)commonTimerWithCountDown:(NSInteger)seconds block: (nonnull void (^)(NSInteger))block;
Parameters
seconds
倒计时描述
block
每秒执行block,为0时自动停止
Return Value
定时器,可手工停止
-
创建NSTimer,使用block,需要调用addTimer:forMode:安排到当前的运行循环中(CommonModes避免ScrollView滚动时不触发)。
Note
示例:[[NSRunLoop currentRunLoop] addTimer:timer forMode:NSRunLoopCommonModes]
Declaration
Objective-C
- (nonnull NSTimer *) timerWithTimeInterval:(NSTimeInterval)seconds block:(nonnull void (^)(NSTimer *_Nonnull))block repeats:(BOOL)repeats;
Parameters
seconds
时间
block
代码块
repeats
是否重复
Return Value
定时器
-
创建NSTimer,使用block,默认模式安排到当前的运行循环中
Declaration
Objective-C
- (nonnull NSTimer *) scheduledTimerWithTimeInterval:(NSTimeInterval)seconds block:(nonnull void (^)(NSTimer *_Nonnull))block repeats:(BOOL)repeats;
Parameters
seconds
时间
block
代码块
repeats
是否重复
Return Value
定时器