I am new to Objective-C and X-Code and basically programming in iOS so this may be a very simple question. Anyway, I'm trying to make a logo quiz wherein the logos and the choices are generated in random order i.e. (Logo 1) --- Choices: A B C D for the first try. Then the next time the user opens the app, Logo 4 appears first with choices A D B C. (I hope that's clear). I've managed to randomly display the logos but can't figure out how to do the same for the choices which would modify the value of 4 buttons below the logo.
From what I've search, you use something like:
[btnA setTitle:@"answer" forState:UIControlStateNormal];
My problem is, I'm thinking of putting the choices into an array as well so I tried something such as this:
[btnA setTitle:[answerArray objectAtIndex:i] forState:UIControlStateNormal];]
Similar to what I've done for the logos but I'm not getting any values for the button. Is there something I'm missing here? I don't get any errors either. Here's a part of my code that might better explain what I've been trying to do:
NSMutableArray *answerList = [[NSMutableArray alloc] initWithObjects:
@"AnswerA",
@"AnswerB",
@"AnswerC",
nil];
answerArray = answerList;
int i = arc4random() % [answerArray count];
[self.btn1 setTitle:[answerArray objectAtIndex:i] forState:UIControlStateNormal];
[self.btn2 setTitle:[answerArray objectAtIndex:i] forState:UIControlStateNormal];
[self.btn3 setTitle:[answerArray objectAtIndex:i] forState:UIControlStateNormal];