1

i can get objc_property_t property name by property_getName(property)

unsigned int outCount;

objc_property_t *properties = class_copyPropertyList([model class], &outCount);

for (int i = 0; i < outCount; i++) {

    objc_property_t property = properties[i];

    NSString *propertyName = [NSString stringWithUTF8String:property_getName(property)];

}

but how can i get the type about property like CGFloat or NSString or NSInteger....

weijia.wang
  • 2,088
  • 2
  • 18
  • 32

1 Answers1

1

Using the objc_property_t, you need to call property_getAttributes() and then the property type is at the front of a rather cryptic string - to see some code that parses the result of that, see this answer:

property type or class using reflection

Community
  • 1
  • 1
Kendall Helmstetter Gelner
  • 74,769
  • 26
  • 128
  • 150