我实现了检查按钮图像的代码。现在我想在单击时更改该按钮中的图像,但每当我单击时,它只显示单个图像。这里我是这样实现的
-
(IBAction)name:(id)sender{
currenttagvalue = [sender tag];int count = 0;
switch (currenttagvalue) {
case 1:
if (count == 0)
{
[level1 setImage:[UIImage imageNamed:@"one_time_selected.png"]
forState:UIControlStateNormal];
count++'
}
if (count == 1)
{
[level1 setImage:[UIImage imageNamed:@"two_time_selected.png"]
forState:UIControlStateNormal];
count++'
}
if (count == 2)
{
[level1 setImage:[UIImage imageNamed:@"one_time_selected.png"]
forState:UIControlStateNormal];
count++'
}
if (count == 2)
{
[level1 setImage:[UIImage imageNamed:@"three_time_selected.png"]
forState:UIControlStateNormal];
count++'
}
提前感谢您