Skip to content

Latest commit

 

History

History
31 lines (20 loc) · 720 Bytes

runtime.md

File metadata and controls

31 lines (20 loc) · 720 Bytes

runtime

Method

class_copyMethodList

拷贝类的所有方法

  • 不会取父类的方法

method_getTypeEncoding

获取方法的返回值和参数类型

NSMethodSignature

SEL selector = method_getName(method);
NSMethodSignature *signature = [class instanceMethodSignatureForSelector:selector];

NSUInteger numberOfArguments = [signature numberOfArguments];

for (int i=0 ; i<numberOfArguments ; i++)
{
    // 参数类型
    NSString *type = [NSString stringWithUTF8String:[signature getArgumentTypeAtIndex:i]];
    NSLog(@"type:%@", type);
}