If I have a uiviewcontroller with a instance variable “direction”. I can do
MyViewController.direction
but if I don’t want the value but a string with the variable name, so I want @”direction”.
Is it possible?
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 retrieve the list of properties using
class_copyPropertyListand you can useproperty_getNameto retrieve the name of the property passing the struct returned by the first method.You can read more on that in Objective-C Runtime programming guide in the Declared Properties section.