Possible Duplicate:
create multiple variables based on an int count
Objective C Equivalent of PHP's “Variable Variables”
I'd like to use some dynamic variable names in a for loop and am stumped as to how to actually reference the variables.
I have a series of UILabels title poll0
- poll8
. Using a for loop, I set their text
value to another value referenced from that corresponding number in an array. For example:
for (int i = 0; i < [pollData count]; i++) {
label(i value).text = [NSString stringWithFormat:@"%@", [[pollData objectAtIndex:i] toString]]; //sorry for the java-esque method names, just create what I'm used to
}
How do I use that i
value?