Person * pp = [Person new];
Class class = object_getClass(pp);//获取类对象的class
Class metaC = objc_getMetaClass(class_getName(class));
if (class_isMetaClass(metaC)) {//如果是元类对象
unsigned int count;
Method * classMethod = class_copyMethodList(metaC, &count);
for (unsigned int i = 0; i<count;i++){
Method method = classMethod[i];
SEL methodName = method_getName(method);
NSLog(@"类方法:%@",NSStringFromSelector(methodName));
}
添加方法: