Last active
July 21, 2017 02:55
-
-
Save edwardean/6ed1cfe52132507a0b6e09b2c00d3555 to your computer and use it in GitHub Desktop.
class_copyPropertyList
This file contains hidden or 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 outCount; | |
objc_property_t *properties = class_copyPropertyList([MyObject class], &outCount); | |
for(i = 0; i < outCount; i++) { | |
objc_property_t property = properties[i]; | |
const char *c_attributes = property_getAttributes(property); | |
printf("%s", c_attributes); | |
} | |
free(properties); | |
属性类型 name值:T value:变化 | |
编码类型 name值:C(copy) &(strong) W(weak) 空(assign) 等 value:无 | |
非/原子性 name值:空(atomic) N(Nonatomic) value:无 | |
变量名称 name值:V value:变化 | |
R | |
The property is read-only (readonly). | |
C | |
The property is a copy of the value last assigned (copy). | |
& | |
The property is a reference to the value last assigned (retain). | |
N | |
The property is non-atomic (nonatomic). | |
G<name> | |
The property defines a custom getter selector name. The name follows the G (for example, GcustomGetter,). | |
S<name> | |
The property defines a custom setter selector name. The name follows the S (for example, ScustomSetter:,). | |
D | |
The property is dynamic (@dynamic). | |
W | |
The property is a weak reference (__weak). | |
P | |
The property is eligible for garbage collection. | |
t<encoding> | |
Specifies the type using old-style encoding. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment