views:

39

answers:

1

Hi, 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?

thanks, alex

A: 

You can retrieve the list of properties using class_copyPropertyList and you can use property_getName to 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.

Eric Fortin