动态方法解析
动态方法解析
@dynamic propertyName;void dynamicMethodIMP(id self, SEL _cmd) {
// implementation ....
}@implementation MyClass
+ (BOOL)resolveInstanceMethod:(SEL)aSEL
{
if (aSEL == @selector(resolveThisMethodDynamically)) {
class_addMethod([self class], aSEL, (IMP) dynamicMethodIMP, "v@:");
return YES;
}
return [super resolveInstanceMethod:aSEL];
}
@end动态加载
Last updated