I would like to know if it is possible to make the name of a variable dynamic:
Instead of this code:
[images1 addObject:nameBild];
[images2 addObject:nameBild];
[images3 addObject:nameBild];
[images4 addObject:nameBild];
images1.alpha = 0.5;
images2.alpha = 0.5;
images3.alpha = 0.5;
images4.alpha = 0.5;
I would like something like this:
for (int i=1; i<5; i++) {
[images(i) addObject:nameBild];
images(i).alpha = 0.5;
}
Or like this way:
for (int i=1; i<5; i++) {
NSMutableString *string1;
NSMutableString *string2;
string1 = @”images";
string2 = string1;
[string2 appendString: i];
[string2 addObject:nameBild];
string2.alpha = 0.5;
}
Can anybody support me in this way? I would be appreciate for an answer. Thanks in advance.
Greetings