Search code examples
iosuitableviewaccessoryviewuibackgroundcolor

How do i change the background color of just the accessory view (ios)?


I can change the cell background by just cell.backgroundColor but i have tried cell.accessoryView.backgroundColor and cell.editingAccessoryView.backgroundColor without any success. I am using the standard disclosure indicator >
I am pretty sure it could be done with a custom button.
But is there not any way i can do it using the default indicator?


Solution

  • Ok. i found a solution was to set the whole cell first (thus setting the accessory view too) and then set the content view which will be on top.

      cell.backgroundColor = [UIColor colorWithRed:255.0/255.0 green:228.0/255.0 blue:157.0/255.0 alpha:0.25];
      cell.contentView.backgroundColor = [UIColor colorWithRed:0.0/255.0 green:0.0/255.0 blue:0.0/255.0 alpha:0.25];