[button setTitleColor:__kColorBlack forState:UIControlStateNormal];
[button setTitleColor:__kColorRed forState:UIControlStateSelected];
[button addTarget:self action:@selector(acreageBtnClick:) forControlEvents:UIControlEventTouchUpInside];
self.acreageBtn = button;
//button点击方法
-(void)acreageBtnClick:(UIButton*)btn{
self.acreageBtn.selected = NO;
btn.selected = YES;
//注意self.acreageBtn.selected = NO和btn.selected = YES顺序不要放错了,否则点击最后一个按钮两次会出现问题,我也不知道为什么,哪位大神知道可以告诉我
self.acreageBtn = btn;
}
网友评论