一旦单击该按钮,我想在表格视图控制器中的另一个图像按钮顶部添加图像。我在 .h 文件中有 UIButton *button。
CellForRow:{
button=[[UIButton alloc]initWithFrame:CGRectMake(230,0,40,40);
[button addTarget:self action:@selector(buttonPressed:withEvent:) forControlEvents:UIControlEventTouchUpInside];
[button setImage:[UIImage imageNamed:"a"] forState:UIControlStateNormal];
button.tag=indexPath.row;
[cell addSuBView:button];
[cell setIndentationWidth:1];
[cell setIndendationLevel:1];
}
-(void)buttonPressed:(id) sender withEvent: (UIEvent *) event{
UIButton *mybtn=(UIButton*) sender;
[mybtn setImage:[UIImage imageNamed:"b"] forState:UIControlStateNormal];
}
这样做是在第一个图像之上显示第二个图像。但我想要的是用新形象代替旧形象。