在您开始之前... ControlState 默认设置为 Normal 并带有 Image 集
当用户单击按钮时,它会更改按钮的图像,因为我将该按钮的目标设置为与所需的方法相对应。当 -(void)RADIOBUTTONAClicked: 被调用时,我需要更改所有其他 RADIOBUTTONS 的图像
-(void)RadioButtonACLicked:{
//code to change radioButton A, the code i have works
// Code to change all other buttons does not work.
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{ .... // 配置单元格...
....
//-------------Creation of Custom Buttons-------------//
//----RadioButtonA----//
....
[radioButtonA addTarget:self action:@selector(radioButtonAClicked:)forControlEvents:UIControlEventTouchUpInside];
[radioButtonA setImage:img2 forState:UIControlStateNormal];
ButtonB 创建
radioButtonB = [UIButton buttonWithType:UIButtonTypeCustom];
[radioButtonB addTarget:self action:@selector(radioButtonBClicked:)forControlEvents:UIControlEventTouchUpInside];
[radioButtonB setImage:img2 forState:UIControlStateNormal];
因此,当单击单选按钮时,我需要将所有其他按钮图像设置为相反。