I have a NSObject
@interface MyObject : NSObject
@property bool pName1;
@property NSString *pName2;
I hope to detect the name(pName1,pName2..) of properties in the function
-(void)dosomething:(id)a
Is it possible?
Welcome any comment
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can get a list of the properties for a given class using the runtime function
class_copyPropertyList(). There’s also a runtime functionproperty_getName()that will give you the name for a given property. Using these two functions, you can get the names of all the properties for a given object.