【发布时间】:2012-06-26 04:55:15
【问题描述】:
我正在更改按钮单击时的 UIButton 图像,但它的位置从原始位置更改为左侧。我不知道为什么会这样。 下面是按钮。当我选择第二个按钮时,它会改变图像并到达左侧。如何解决此错误?
下面是我的代码
-(IBAction)locationOneButtonAction{
UIImage *buttonImage = [UIImage imageNamed:@"radiogreen.png"];
UIImage *buttonImageOne=[UIImage imageNamed:@"radiowhite.png"];
[locationOneButton setImage:buttonImage forState:UIControlStateNormal];
[locationOneButton setImage:buttonImage forState:UIControlStateNormal];
[locationThreeButton setImage:buttonImageOne forState:UIControlStateNormal];
[locationTwoButton setImage:buttonImageOne forState:UIControlStateNormal];
[locationFourButton setImage:buttonImageOne forState:UIControlStateNormal];
[locationFiveButton setImage:buttonImageOne forState:UIControlStateNormal];
[locationSixButton setImage:buttonImageOne forState:UIControlStateNormal];
resturantLocation=@"Common Man - Bedford, MA";
}
【问题讨论】:
-
您的图片尺寸可能不同
-
@Eric 是的,你是对的,它们的尺寸不同
-
在那种情况下,图像似乎在移动?