UIButton*payBtn = [UIButtonbuttonWithType:UIButtonTypeCustom];
payBtn.frame=CGRectMake(size.width-24-15,13,24,24);
payBtn.tag= j +1;
[payBtnsetImage:IMG(@"selectNo")forState:UIControlStateNormal];
[payBtnsetImage:IMG(@"selectNo")forState:UIControlStateHighlighted];
[payBtnsetImage:IMG(@"selectYes")forState:UIControlStateSelected];
[payBtnsetImage:IMG(@"selectYes")forState:UIControlStateSelected|UIControlStateHighlighted];
[payBtnaddTarget:selfaction:@selector(selectPayStyle:)forControlEvents:UIControlEventTouchUpInside];
[payStyleLabeladdSubview:payBtn];
- (void)selectPayStyle:(UIButton*)btn{
if(btn !=self.selectedBtn) {
self.selectedBtn.selected=NO;
btn.selected=YES;
self.selectedBtn= btn;
}else{
self.selectedBtn.selected=YES;
}
}
效果图如下