How to retrieve a property from a class using a variable as the name?
This is more a C question than an iPhone question I guess. I have a class with a bunch of properties, they are all either @synthezised or have proper setters/getters.
Now I need to retrieve that value in them by using a dynamic name.
I just can't figure out how to do it.
Pseudocode:
MyClass{
NSString *firstName;
NSString *lastName;
}
CallerClass {
MyClass myClass = [MyClass alloc];
NSString propertyName = @"firstname";
// NEED HELP HERE:
NSString theValue = myClass.getByWhateverTheMethodIsCalled(propertyNam e);
}
|