Uitableview Ios中的表格单元格颜色

Uitableview Ios中的表格单元格颜色,uitableview,ios7,Uitableview,Ios7,我想在敲击时更改表格单元格的颜色。当释放水龙头时,它将恢复到初始颜色。我没有应用选择样式。我曾尝试在did select方法中更改颜色,但它在点击后正在更改颜色,效果是永久性的 - (BOOL)tableView:(UITableView *)tableView shouldHighlightRowAtIndexPath:(NSIndexPath *)indexPath { return YES; } - (void)tableView:(UITableView *)tableView

我想在敲击时更改表格单元格的颜色。当释放水龙头时,它将恢复到初始颜色。我没有应用选择样式。我曾尝试在did select方法中更改颜色,但它在点击后正在更改颜色,效果是永久性的

- (BOOL)tableView:(UITableView *)tableView shouldHighlightRowAtIndexPath:(NSIndexPath *)indexPath {
    return YES;
}
- (void)tableView:(UITableView *)tableView didHighlightRowAtIndexPath:(NSIndexPath *)indexPath {
    CustomCell *cell = (CustomCell *)[tableView cellForRowAtIndexPath:indexPath];
    [self setCellColor:[UIColor yellowColor] ForCell:cell];
}
- (void)tableView:(UITableView *)tableView didUnhighlightRowAtIndexPath:(NSIndexPath *)indexPath {
    CustomCell *cell = (CustomCell *)[tableView cellForRowAtIndexPath:indexPath];
    [self setCellColor:[UIColor colorWithWhite:1.0 alpha:1.0] ForCell:cell];
}
- (void)setCellColor:(UIColor *)color ForCell:(UITableViewCell *)cell {
    cell.contentView.backgroundColor = color;
    cell.backgroundColor = color;
}