2011-10-17 116 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

相關問題