//几个按钮共用一个方法,点击的时候切换图片问题
-(void)databtn:(UIButton*)sender
{
UIButton *btn = (UIButton *)sender;
for (UIButton *button in _btnArray)
{
if (button==btn)
{
button.backgroundColor=[UIColoryellowColor];
}
else
{
button.backgroundColor=[UIColorredColor];
}
}
}
//点击按钮的时候,点击谁,谁的颜色发生变化,点击本身的时候,不变
-(void)databtn:(UIButton*)sender
{
UIButton *btn = (UIButton *)sender;
for (UIButton *button in _btnArray)
{
if (button==btn)
{
button.backgroundColor=[UIColoryellowColor];
}
else
{
button.backgroundColor=[UIColorredColor];
}
}
}
版权声明:本文为m7723sun原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。