Declared Properties
使用函数,根据property的name,通过metadata来读取一个class, category or protocol 的property类型(@encode String 表示),copying 得到一个array of C Strings 的列表。
example:
@interface Lender: NSObject{
floar alone;
}
@property float alone;
@end
id LenderClass = objc_getClass(“Lender”);
unsigned int outCount, i;
objc_property_t *properties = class_copyPropertyList(LenderClass, &outCount);
for(i=0; i<outCount; i++){
objc_property_t proterty =proterties[i];
fprintf(stdout, “%s %s \n”, property_getName(property), property_getAttributes(property));
}
Property Tyep String
Property String 由T开始,紧跟着@encode type和一个comma,然后是一个V,再跟着一个变量的name。如:
@property char charDefault; --> Tc,VcharDefault
@property (nonatomic, readonly, copy) id idReadonlyCopyNonatomic; --> T@,R,C,VidReadonlyCopyNonatomic