Created
January 24, 2013 11:26
-
-
Save 1901/4620303 to your computer and use it in GitHub Desktop.
Objective-C获取所有的类
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
int numClasses = 0; | |
Class * classes = NULL; | |
numClasses = objc_getClassList(NULL, 0); | |
if (numClasses > 0 ) | |
{ | |
classes = malloc(sizeof(Class) * numClasses); | |
numClasses = objc_getClassList(classes, numClasses); | |
for (int i = 0; i < numClasses; i++) | |
{ | |
Class cls = classes[i]; | |
NSLog(@"[%d]:%@", i, NSStringFromClass(cls)); | |
} | |
free(classes); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment