I know xcode don’t have radio Button
so I try to add a custom button and make it action like a radio button
This is the image I use


and this is the code I set to cell
UIButton *but = [UIButton buttonWithType:UIButtonTypeCustom];
[but setImage:[UIImage imageNamed:@"radio-off.png"] forState:UIControlStateNormal];
[but setImage:[UIImage imageNamed:@"radio-on.png"] forState:UIControlStateSelected];
[but setFrame:CGRectMake(0, 0, 44, 44)];
[but addTarget:self action:@selector(radioButton:) forControlEvents:UIControlEventTouchUpInside];
cell.accessoryView= but;
and this is the problem I want to ask is
how can I give a void in - (IBAction)radioButton:(UIButton *)button
To control Two Radio Button in Two Rows
If Row 1 Radio button’s selected is YES
btn in row 2 will be btn.state=NO and won’t response the
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
It will be like this pic

How to set the if conditions in - (IBAction)radioButton:(UIButton *)button
this pic is fake…I only add the button in the cell…and changed the text color
Great Thanks to all stack overflow friends~
You will need an array of all the radio buttons. Remember that table cells get recycled/may not be visible, etc. so create an array just with the buttons and then grab the right button out of that array in your
tableView:cellForIndexPath:method.So in your
tableView:cellForIndexPath:method you would do something like this:Then, in your
radioButton:radioButtonPressed:method you would do: