按钮的互斥

1.首先准备一个记录用的UIButton

@property(nonatomic,strong) UIButton *selectBtn;

2.cellForRow方法中设置,cell中被点击的payCell.selectButton.tag=indexPath.row


给按钮赋值 payCell.selectButton.selected = YES;

self.selectBtn = payCell.selectButton;

3.来到btnClick的方法(这里要把cell点击时的btn作为一个参数传过来)

- (void)selectBtnClick:(UIButton *)sender   //这里的sender就是cell被点击的btn

{

self.selectBtn.selected = NO;

sender.selected = YES;

self.selectBtn = sender;

}

你可能感兴趣的:(按钮的互斥)