- (void)performSelector:(SEL)aSelector withObject:(nullable id)anArgument afterDelay:(NSTimeInterval)delay inModes:(NSArray<NSRunLoopMode> *)modes;
- (void)performSelector:(SEL)aSelector withObject:(nullable id)anArgument afterDelay:(NSTimeInterval)delay
performSelector N秒钟之后 执行方法
- (void)cancelPreviousPerformRequestsWithTarget:(id)aTarget selector:(SEL)aSelector object:(nullable id)anArgument;
- (void)cancelPreviousPerformRequestsWithTarget:(id)aTarget
cancelPreviousPerformRequestsWithTarget:取消performSelector方法注册过的方法,就是说当上面这个方法正在运行,比如希望5秒钟之后执行某一个方法,但是没到5秒钟的情况下取消performSelector,就是用cancelPreviousPerformRequestsWithTarget方法来实现的
网友评论