Let's say I've got several UILabels which have been set up in IB and connected to IBOulets in code (label1, label2, label3, label4)
How would I create these variable names within code, so that I could change the text of each one in a loop, where the labels are taken from a NSArray.
Here's the pseudo-code:
labelArray = [NSArray arrayWithObjects:@"this", @"array", @"has", @"a", @"random", @"amount", @"of", @"items", nil];
for (int i = 0; i < [labelArray count]; i++)
{
// labelx is the constructed name of the IBOutlet
lablex.text = [labelArray objectAtIndex:i];
}
How do I construct 'labelx' above? Could this be done using Blocks?