拦截方法并替换成自己的方法

   #import <objc/runtime.h>

    

    

    Method method1 = class_getInstanceMethod([self class],@selector(didAddSubview:));

    

    Method method2 = class_getInstanceMethod([self class], @selector(didModifyRange:));

    method_exchangeImplementations(method1, method2);

posted @ 2016-08-30 22:33  泡菜2015  阅读(194)  评论(0编辑  收藏  举报