Created
January 30, 2015 08:13
-
-
Save dabing1022/d0e42abf2a1ce4b9b7ac to your computer and use it in GitHub Desktop.
LogClassMethods
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)logClassMethods:(Class)class | |
{ | |
NSString* className = NSStringFromClass(class); | |
const char* cClassName = [className UTF8String]; | |
id theClass = objc_getClass(cClassName); | |
unsigned int outCount; | |
Method* m = class_copyMethodList(theClass, &outCount); | |
NSLog(@"Class: %@, has methods: %d", className, outCount); | |
for (int i = 0; i < outCount; i++) { | |
SEL selector = method_getName(*(m+i)); | |
NSString* selectorName = NSStringFromSelector(selector); | |
if ([selectorName hasPrefix:@"_"]) { | |
NSLog(@"%d 私有---> %@", (i+1), selectorName); | |
} else { | |
NSLog(@"%d 公有---> %@", (i+1), selectorName); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment