Note that there are some explanatory texts on larger screens.

plurals
  1. POcustom RadioButton selected one at a time for iphone?
    primarykey
    data
    text
    <p>I have dynamically created some list of RadioButtons with some values. pro grammatically I changed the button state and changed the image for selected and unselected. but the problem is i can select the all radioButtons at same time. actually I need to select one at a time. when I clicked the next RadioButton, previously selected button state should be changed to non-selected.</p> <p>Here is my code, I tried with changing image, but ...some problem with my code.</p> <pre><code> RadioButton = [UIButton buttonWithType:UIButtonTypeCustom]; [RadioButton setFrame:CGRectMake(0.0f, 0.0f, 20, 20)]; [RadioButton setCenter:CGPointMake(116.0,p1)]; [RadioButton setSelected:NO]; [RadioButton setImage:[UIImage imageNamed:@"uncheck.png"] forState:UIControlStateNormal]; [RadioButton addTarget:self action:@selector(RadioButtonTapped:) forControlEvents:UIControlEventTouchUpInside]; [self.scrollView addSubview:RadioButton]; -(void)RadioButtonTapped:(id)sender { UIButton *RadioButton1 = (UIButton*)sender ; [self radiobuttonAction:RadioButton1]; } -(void)radiobuttonAction:(UIButton *)Button { if(![Button isSelected]) { [Button setSelected:YES]; [Button setImage:[UIImage imageNamed:@"radio_active.png"] forState:UIControlStateSelected]; //not working, button image is not changing } else { [Button setSelected:NO]; [Button setImage:[UIImage imageNamed:@"radio_inactive.png"] forState:UIControlStateNormal]; } } </code></pre> <p>where can I change the image of previously selected button.</p> <p>thanks in advance</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload