在UITableViewCell中更改附件视图的背景颜色



我有一个自定义单元格(不使用xib),我正在尝试更改附件视图的背景颜色。这是我的代码和我尝试过的"

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    customCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cellID" forIndexPath:indexPath];
    cell.accessoryView.backgroundColor = [UIColor redColor];
    return cell;
}

结果:

背景颜色没有改变。

您可以通过以下两种方式之一执行此操作。您可以更改表视图的色调颜色,这将更改附件的颜色,也可以拖动所需的任何视图或控件,并将其颜色更改为所需的任何颜色。

最新更新