oc 函数节流

#import "FunctionThrottleUtil.h"


@implementation FunctionThrottleUtil


/*函数节流*/

+(void)startWithTarget:(id)aTarget  delayCallback:(SEL) fireBlockAfterDelay{

    [FunctionThrottleUtil startWithTarget:aTarget delayCallback:fireBlockAfterDelay delay:1];

}

+(void)startWithTarget:(id)aTarget  delayCallback:(SEL) fireBlockAfterDelay delay: (NSTimeInterval)delay{

    [NSObject cancelPreviousPerformRequestsWithTarget:aTarget selector:fireBlockAfterDelay object:nil];

    [aTarget performSelector:fireBlockAfterDelay withObject:nil afterDelay:delay];

}

@end

你可能感兴趣的:(ios,学习)