- (void)sing;
- (void)singSong {
NSLog(@"%s", __func__);
}
#pragma mark 实例方法的动态方法解析
+ (BOOL)resolveInstanceMethod:(SEL)sel {
if (sel == @selector(sing)) {
Method method = class_getInstanceMethod(self, @selector(singSong));
class_addMethod(self, sel, method_getImplementation(method), method_getTypeEncoding(method));
return YES;
}
return [super resolveInstanceMethod:sel];
}







网友评论