在我的iPhone應用程序我創建UIImageViews的編程那樣,如何在我的buttonActon改變的UIImageView圖像的編程
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];
}
,我想是的UIImageView的形象改變到另一個圖像。但我不能那樣做。誰能幫我?謝謝。
你不能這樣做,因爲? [你有什麼嘗試?](http://mattgemmell.com/2008/12/08/what-have-you-tried/) – Pfitz 2013-04-26 13:18:53