【发布时间】:2015-06-04 06:23:20
【问题描述】:
我正在尝试更改按钮颜色,然后点击它,但它不起作用,因为这样做我必须检测按钮当前必须更改为下一种颜色的颜色。
if (sender.backgroundColor == [UIColor clearColor]) {
[sender setBackgroundColor:[UIColor grayColor]];
} else if (sender.backgroundColor == [UIColor grayColor]) {
[sender setBackgroundColor:[UIColor blueColor]];
} else if (sender.backgroundColor == [UIColor blueColor]) {
[sender setBackgroundColor:[UIColor redColor]];
} else {
[sender setBackgroundColor:[UIColor clearColor]];
}
但不幸的是,它不起作用。 有谁知道我怎样才能做到这一点?
【问题讨论】:
标签: ios xcode button background-color