可以看到苹果SDK的私有方法哦

2019-04-14 19:52发布

NSString *className = NSStringFromClass([UIView class]);
    
    const char *cClassName = [className UTF8String];
    
    id theClass = objc_getClass(cClassName);
    
    unsigned int outCount;
    

    Method *m =  class_copyMethodList(theClass,&outCount);
    
    NSLog(@"%d",outCount);
    for (int i = 0; i         SEL a = method_getName(m);
        NSString *sn = NSStringFromSelector(a);
        NSLog(@"%@",sn);
    }