Skip to content

Commit 4b14918

Browse files
authored
Update README.md
1 parent 7bf2bb7 commit 4b14918

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

README.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,24 @@
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

0 commit comments

Comments
 (0)