美文网首页
打印类的方法列表

打印类的方法列表

作者: Jean_Lina | 来源:发表于2022-05-18 12:09 被阅读0次
#pragma mark 打印类的方法列表
- (void)getMethodList:(Class)cls {
    unsigned int count;
    NSMutableString *string = [NSMutableString string];
    Method *methodList = class_copyMethodList(cls, &count);
    for (int i = 0; i < count; i++) {
        Method method = methodList[i];
        SEL sel = method_getName(method);
        NSString *methodName = NSStringFromSelector(sel);
        [string appendString:methodName];
        [string appendString:@" "];
    }
    free(methodList);
    NSLog(@"打印方法列表:%@", string);
}

相关文章

网友评论

      本文标题:打印类的方法列表

      本文链接:https://www.haomeiwen.com/subject/yrmcyltx.html