I am looking for a way to access one of my property from its name. For example, I have 3 properties in a particular class as
@property (nonatomic, weak) UIImageView *image1;
@property (nonatomic, weak) UIImageView *image2;
@property (nonatomic, weak) UIImageView *image3;
And I have a method as
- (void)accessProperty:(NSString *)propertyName{
//image1, image2 or image3 will be passed here.
//how can I access the property with its name ?????
}
Any help will be appreciated.
Let me mention my need more precisely.
I have 3 imageView
but I want to set image to the particular imageView who's name matches with the name I passed to the method. For example if I will call the method as
[self accessProperty:@"image1"];
Then it should set image to imageView1
only