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];

}

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容