user4487951
user4487951

Reputation:

Change background color of accessoryView in UITableViewCell

I have a custom cell (not using xib), and I'm trying to change the background color of the accessory view. Here is my code and what I tried"

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    customCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cellID" forIndexPath:indexPath];

    cell.accessoryView.backgroundColor = [UIColor redColor];

    return cell;
}

Results:

The background color didn't change.

Upvotes: 1

Views: 2682

Answers (1)

rdelmar
rdelmar

Reputation: 104082

You can do this in either of two ways. You can change the table view's tint color, which will change the color of the accessory, or you can drag in any view or control you want, and change its color to whatever you want.

Upvotes: 1

Related Questions