Possible Duplicate:
Objective C Equivalent of PHP’s “Variable Variables”
I have a UIButton action, that grabs the button sender
This line gives me the sender tag which I'm using in a switch statement
int senderTag = [sender tag];
I then have to do...
switch (senderTag) {
case 1:
brain.selectedPaintColor1 = myColor;
break;
case 2:
brain.selectedPaintColor2 = myColor;
break;
case 3:
brain.selectedPaintColor3 = myColor;
...
What I'd really like to be able to do is use the tag to set a variable property name like this
[brain.selectedPaintColor%i,senderTag] = myColor;
Can anyone assist with the syntax to be able to do that?
Thanks!