获取当前类中所有的方法

 

#import <objc/runtime.h>

 

#import <objc/message.h>

- (void)methods

{

    

 

    unsigned int count;

    Method *methods = class_copyMethodList([self class], &count);

   

    for (int i = 0; i < count; i++)

    {

        Method method = methods[i];

        SEL selector = method_getName(method);

        NSString *name = NSStringFromSelector(selector);

        

        NSLog(@"方法名字 ==== %@",name);

   

    }

}

猜你喜欢

转载自siruoxian.iteye.com/blog/2171099