Possible Duplicate:
object with the name of a string
I want to call the code below, but be able to change “itemInstance” with a stringe variable. Is this possible?
UIImage *image = [itemInstance getImage:itemNumber];
EDIT: I just read about the NSSelectorFromString method which appears to be what I need to use, but I have no idea how it’s supposed to implemented. Any ideas?
Not exactly. The simplest way to get that effect is to build a NSDictionary with your strings as the keys and the matching instances as the values. Then it becomes something like: