Created
March 30, 2012 17:48
-
-
Save bhoomesh/2253321 to your computer and use it in GitHub Desktop.
Need a good list of every UIView subclass use class lister?
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
extern "C" { | |
int objc_getClassList(Class*, int); | |
Class class_getSuperclass(Class cls); | |
const char * class_getName(Class cls); | |
} | |
- (void)viewDidLoad { | |
int numClasses = objc_getClassList(NULL, 0); | |
Class *classes = NULL; | |
classes = (Class*)malloc(sizeof(Class) * numClasses); | |
numClasses = objc_getClassList(classes, numClasses); | |
for(int i = 0; i < numClasses; i++) { | |
Class cls = classes[i]; | |
for(Class c = cls; c = class_getSuperclass(c);) { | |
if(!strcmp(class_getName(c), "UIView")) { | |
cout << class_getName(cls) << endl; | |
break; | |
} | |
} | |
} | |
free(classes); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment