properties - Way to get information on whether or not a property is set readonly in objective-c -
i have got properties in objective-c declared readonly such as:
@property (nonatomic, readonly) nsstring* aproperty; and want information on properties readability treat them differently (e.g. change way how information them displayed in gui). thats why need way ask if property readonly (i have got list of property names , objects in contained). there way achieve this? - example using objective-c runtime.
objc_property_t prop = class_getproperty([object class], [aproperty utf8string]); if (!prop) { // doesn't exist object return nil; } const char * propattr = property_getattributes(prop); nsstring *propstring = [nsstring stringwithutf8string:propattr]; nsarray *attrarray = [propstring componentsseparatedbystring:@","]; attrarray contain properties refer apple doc
Comments
Post a Comment