I tried to list all properties of an Objective-C class like described in the Objective-C 2.0 Runtime Programming Guide:
id LenderClass = objc_getClass("UIView");
unsigned int outCount, i;
objc_property_t *properties = class_copyPropertyList(LenderClass, &outCount);
for (i = 0; i < outCount; i++) {
objc_property_t property = properties[i];
fprintf(stdout, "%s %s
", property_getName(property), property_getAttributes(property));
}
But this lists only three properties:
userInteractionEnabled Tc,GisUserInteractionEnabled
layer T@"CALayer",R,&,V_layer
tag Ti,V_tag
Looking at the header file for UIView.h those are the three properties directly declared in the class. The other UIView properties are added through categories.
How do I get all properties of a class, including those coming from categories?
I tried this with the iPhone simulator (iPhone SDK 2.2.1), btw. (in case this is important).
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…