我想更改按钮单击图像视图中的图像,但它不会更改。我使用的JPG图像在图像查看加载如何更改imageView上的图像按钮单击
- (IBAction) changeImage:(id)sender
{
UIButton *tappedButton = (UIButton*) sender;
NSInteger selectedIndex = [tappedButton tag];
if (selectedIndex==0)
{
UIImage *modelimage = [UIImage imageNamed:@"compositone.jpg"];
modelImagewView.image=modelimage;
}
else
{
UIImage *modelimage = [UIImage imageNamed:@"composittwo.jpg"];
modelImagewView.image=modelimage;
}
}
这是一个故事板的项目?你确定你已经正确连接了IBAction吗? – Garoal 2012-01-28 07:24:12