单选button
2018-03-28 本文已影响1人
阶梯
定义一个全局button, 用来记录上次选中的button
if (!self.oldButton) {
sender.selected = YES;
self.oldButton = sender;
}
else if (self.oldButton !=nil && self.oldButton == sender)
{
sender.selected = YES;
}
else if (self.oldButton!=sender && self.oldButton!=nil)
{
self.oldButton.selected = NO;
sender.selected=YES;
self.oldButton = sender;
}