2011-08-18 40 views

回答

1

使用此在您的表視圖代表:

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { 
    cell.backgroundColor = [UIColor redColor]; 
} 

您還可以設置單元格的selectedBackgroundView到自定義視圖,並設置其的backgroundColor。

+0

nope。我不使用backgroundcolor,我使用backgroundView。我可以看到我定義的標準視圖,而不是高亮顯示。 –

+0

backgroundView是正常的backgroundView,selectedBackgroundView是選中單元格時使用的,但僅當它存在時才使用。 –

1

你只需要設置兩個UITableViewCell屬性backgroundView和selectedBackgoundView。 iOS將完成剩下的工作。