List of class properties in Objective-C

前端 未结 6 1946
南方客
南方客 2020-11-29 17:32

Is there a way to get an array of class properties of certain kind? For example if i have interface like this

@interface MyClass : NSObject
    @property (st         


        
6条回答
  •  日久生厌
    2020-11-29 17:55

    You must include the runtime headers

     #import
    uint propertiesCount;
    objc_property_t *classPropertiesArray = class_copyPropertyList([self class], &propertiesCount);
    free(classPropertiesArray);
    

提交回复
热议问题