增加点击间隔
实现原理
具体实现
#import "objc/runtime.h"
/*
*/
//点击间隔
@property(nonatomic, assign) NSTimeInterval nx_acceptEventInterval;
// 是否忽略本次点击
@property(nonatomic) BOOL ignoreEvent;+ (void)load
{
//UIControl:
Method a = class_getInstanceMethod(self, @selector(sendAction:to:forEvent:));
Method b = class_getInstanceMethod(self, @selector(__uxy_sendAction:to:forEvent:));
/*
//UIView:
Method a = class_getInstanceMethod(self, @selector(gestureRecognizerShouldBegin:));
Method b = class_getInstanceMethod(self, @selector(__nx_gestureRecognizerShouldBegin:));
*/
//改变两个方法的实现
method_exchangeImplementations(a, b);
}Last updated