+ (NSMutableArray *)getClassMethodWithClass:(Class)cls{
//获得方法数组
unsigned int count;
Method * methodList = class_copyMethodList(cls, &count);
NSMutableArray * methods = [[NSMutableArray alloc]initWithCapacity:0];
//循环遍历获得方法名
for (int i = 0; i<count; i++) {
Method method = methodList[i];
NSString * methodStr = NSStringFromSelector(method_getName(method));
[methods addObject:methodStr];
}
return methods;
}
网友评论