If I had two variables in Objective C like this where one holds the name of the other as a string
NSInteger result = 4;
NSString * theName = @"result";
How would I best access the first variable using the string instead of a reference to the variable? For instance if I had a lot of variables and would generate the name of the one I need by code I’d need a way to get to the variable using that string.
Though not directly answering your question, it’s possible to access properties (or ivars) of an object by
Similarly, the getter is
[object valueForKey:theName](thanks kevboh!)