First set the desired cell background screen, and then set the background view selected by the cell (within the same range as the cell background).
you can specify the cornerRadius property so that you can set the rounding of the corners as desired, I omitted this property in my case
Here is the code for both:
UIView *bg = [[UIView alloc] initWithFrame:cell.bounds]; bg.backgroundColor = [UIColor colorWithRed:0.980 green:0.988 blue:0.984 alpha:1]; bg.layer.borderColor = [UIColor colorWithRed:0.827 green:0.827 blue:0.835 alpha:1].CGColor; bg.layer.borderWidth = kCellBorderWidth; // bg.layer.cornerRadius= kCellBorderRadius; cell.backgroundView = bg; // to make cell selection square and not round (which is by default) UIView *bg_selected = [[UIView alloc] initWithFrame:cell.bounds]; bg_selected.backgroundColor = [UIColor lightGrayColor]; bg_selected.layer.borderColor = [UIColor colorWithRed:0.827 green:0.827 blue:0.835 alpha:1].CGColor; bg_selected.layer.borderWidth = kCellBorderWidth; cell.selectedBackgroundView = bg_selected;
source share