如何在iPhone上单击更改TableView Cell按钮 [英] how to change tableView Cell button on click in iphone
本文介绍了如何在iPhone上单击更改TableView Cell按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我具有带有自定义单元格的表格视图,并且具有按钮,我希望当用户单击该按钮时,该按钮的图像应更改任何想法,因为我希望通过另一种方法更改cellImage按钮图像
I have table view with custom cell and it has button i want that when user click on that button then the image of button should be changes any idea how to do this becuase i want that cellImage button image to be changed in another method.
[cell.theSyncButton addTarget:self action:@selector(syncButtonAction:) forControlEvents:UIControlEventTouchUpInside];
[cell.theSyncButton setTag:indexPath.row];
方法:
-(IBAction)syncButtonAction:(id)sender{
// I want to change the cell.SyncButton image here
}
任何想法如何做到这一点.
any idea how to do this.
推荐答案
除了所有代码,您要做的就是:
Instead of all that code you have all you have to do is:
UIImage *img = [UIImage imageNamed:@"yourImage.png"];
[cell.theSyncButton setImage:img forState:UIControlStateSelected];
这篇关于如何在iPhone上单击更改TableView Cell按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文