growingio与自定义的uicontrol 分类 hook冲突解决方法

// 在load时执行hook

+ (void)load {

    Methodbefore  =class_getInstanceMethod(self,@selector(sendAction:to:forEvent:));

    Methodafter    =class_getInstanceMethod(self,@selector(cs_sendAction:to:forEvent:));

    method_exchangeImplementations(before, after);

}

- (void)cs_sendAction:(SEL)action to:(id)target forEvent:(UIEvent*)event {


    if (![NSStringFromSelector(action) hasPrefix:@"growingHook"]) {

        if ([NSDate date].timeIntervalSince1970 - self.cs_acceptEventTime < self.cs_acceptEventInterval) {

            return;

        }


        if (self.cs_acceptEventInterval > 0) {

            self.cs_acceptEventTime = [NSDate date].timeIntervalSince1970;

        }

    }


    [selfcs_sendAction:actionto:targetforEvent:event];

}

你可能感兴趣的:(growingio与自定义的uicontrol 分类 hook冲突解决方法)