2011-10-17 45 views

回答

3

你知道它是哪个单元,因为你有一个索引路径。 您知道该单元格上有一些imageview图像。 因此,您唯一需要做的就是找到该单元格将图像更改为您想要的图像并更新tableview。

事情是这样的:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    CustomCell *cell = (CustomCell*)[self tableView:tableView cellForRowAtIndexPath:indexPath]; 

    cell.myCustomImageView.image = myNewImage. 

    [myTableView reloadData]; 
} 
0

您可以使用(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath,只是将里面的形象。

1

尝试设置UITableViewCell的selectedBackgroundView。

+0

我试过了cell.selectedBackgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@“listBackgroundSelected.png”]]; ...但它不起作用 – cannyboy

+0

你用tableView单元格的contentView做了什么吗? – Ilanchezhian

相关问题