[英]Changing tableView Cell Image on selection shows multple selected cell images
[英]Changing selection image with custom table cell
我有一個帶有自定義背景圖像的自定義UITableViewCell ..如何在選擇時更改該圖像?
你知道它是哪個單元格,因為你有一個索引路徑。 您知道單元格上有圖像的圖像視圖。 因此,您唯一需要做的就是找到單元格將圖像更改為您想要的圖像並更新tableview。
像這樣的東西:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
CustomCell *cell = (CustomCell*)[self tableView:tableView cellForRowAtIndexPath:indexPath];
cell.myCustomImageView.image = myNewImage.
[myTableView reloadData];
}
嘗試為UITableViewCell設置selectedBackgroundView。
你可以使用(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
,只需更改你的圖像。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.