Hi,
I am doing an application on a Multiple Choice Question (MCQ) where I have to get questions, answers from a webservice. I have 1 question with 4 options, among the 4 options, I have 1 correct answer. Each of the options, I created a button programmatically. This is how I did it:
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
button.frame = CGRectMake(40, yButton, 30, 30);
[button setTitle:@" " forState:UIControlStateNormal];
[button addTarget:self action:@selector(correctPressed)
forControlEvents:UIControlEventTouchDown];
[buttonArray addObject:button];
How many options I have in a questions will determine how many buttons will be created. Now when I want to show an indication that when a certain button is clicked, that button needs to stay highlighted until I decides to change my answer. I have done a few approaches.
I used IndexPath
, hoping I could use indexPath.row
like in TableView
. It didnt work out at all. Can anyone help?
Thanks