更改分段表中所选单元格的uitableviewcell颜色

iCo*_*r86 2 iphone uitableview

我已经为每个部分分区了表格视图和检查选择(每个部分只允许单选,如单选按钮).

现在我想要做的是我想要改变用户选择的单元格的颜色(不是使用单元格的selectedBackgroundView属性动画的时间颜色变化的一小部分).

请帮忙.

谢谢.

use*_*977 16

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    cell.contentView.backgroundColor = [UIColor colorWithRed:1.0 green:0.0 blue:0.0 alpha:1.0];
Run Code Online (Sandbox Code Playgroud)


Meh*_*tri 5

使用此代码........

 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
 {
     UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
     cell.contentView.backgroundColor = [UIColor yellowColor];
 }
Run Code Online (Sandbox Code Playgroud)

快乐编码....