Hi everyone, I am using the following array:
NSMutableArray *buttonNames = [NSMutableArray arrayWithObjects:@"button1", @"button2", @"button3", nil];
I then want to loop through this array and create UIButtons with each array element as the object name, something like this:
for(NSString *name in buttonNames) {
UIButton name = [UIButton buttonWithType:UIButtonTypeCustom];
// ... button set up ...
}
However this doesn't work, I would hope it would give me three UIButtons called button1, button2, and button3.
Is this possible in objective-c? I'm pretty sure this is to do with a pointer/object issue, but I can't seem to find any similar examples to go by. Thanks for any answers, they will be greatly appreciated!