在我的 ios 应用程序中,我像这样以编程方式创建 uiimageviews,
for (int i=0; i<20; i++) {
productID=[products objectAtIndex:i];
UIButton * button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button setFrame:CGRectMake(column*197+38 , row*350+8, 159, 45)];
//[button setImage:redButtonImage forState:UIControlStateNormal];
[button addTarget:self
action:@selector(buttonAction:)
forControlEvents:UIControlEventTouchUpInside];
button.tag = productID;
[scrollView addSubview:button];
UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(column*197+170, row*350+25, 13, 13)];
imageView.tag=productID;
UIImage *image = [UIImage imageNamed:@"redImage.png"];
[imageView setImage:image];
[scrollView addSubview:imageView];
}
在我的 buttonActon 中,我想将该 uiimageview 的图像更改为另一个图像。但我不能那样做。谁能帮我?谢谢你。