void Swizzle(Class c, SEL origSEL, SEL newSEL)
{
Method origMethod = class_getInstanceMethod(c, origSEL);
Method newMethod = class_getInstanceMethod(c, newSEL);
if(class_addMethod(c, origSEL, method_getImplementation(newMethod), method_getTypeEncoding(newMethod)))
class_replaceMethod(c, newSEL, method_getImplementation(origMethod), method_getTypeEncoding(origMethod));
else
method_exchangeImplementations(origMethod, newMethod);
}
Cocoa与Swift在iOS开发中的应用
2497

被折叠的 条评论
为什么被折叠?



