File tree Expand file tree Collapse file tree 1 file changed +10
-11
lines changed Expand file tree Collapse file tree 1 file changed +10
-11
lines changed Original file line number Diff line number Diff line change 1010 //获取类的属性
1111 - (void)getPropertyList {
1212
13- //属性个数
13+ //属性个数
1414
15- unsigned int count;
15+ unsigned int count;
1616
17- objc_property_t *properties = class_copyPropertyList([self class], &count);
17+ objc_property_t *properties = class_copyPropertyList([self class], &count);
1818
19- for (int i = 0; i < count; i++) {
19+ for (int i = 0; i < count; i++) {
2020
21- objc_property_t property = properties[i];
21+ objc_property_t property = properties[i];
2222
23- const char *name = property_getName(property);
23+ const char *name = property_getName(property);
2424
25- NSString *nameStr = [NSString stringWithCString:name encoding:NSUTF8StringEncoding];
25+ NSString *nameStr = [NSString stringWithCString:name encoding:NSUTF8StringEncoding];
2626
27- NSLog(@"***属性名:%@", nameStr);
27+ NSLog(@"***属性名:%@", nameStr);
2828
29- }
30-
31- }
29+ }
30+ }
3231
3332此种方法只能获取类的属性,像:
3433
You can’t perform that action at this time.
0 commit comments