获取加方法 : class_getClassMethod
Method method1 = class_getClassMethod ( [Person class],@selector(run) );
获取减方法 : class_getInstanceMethod
Method method2 = class_getInstanceMethod ( [Person class],@selector(sleep) );
交换方法 : method_exchangeImplementations( 方法1,方法2 );
method_exchangeImplementations(method1, method2);
网友评论