0

As per title, with darkMode the selection of a grouped cell is not working as expected: the ContentView of a cell is not selected on touch, only the AccessoryView. Everything works fine on the LightMode.

I have changed the background color of both the cell and its content view to Default (Table Cell Grouped Background Color) in the StoryBoard. If it can help, the background color of the accessoryView is made equal to the background color of the Content View in the willDisplay cell function

favouriteCell.contentView.superview?.backgroundColor = favouriteCell.contentView.backgroundColor

enter image description here

Gianni
  • 135
  • 12
  • 1
    or maybe it's working but your cell color in darkMode is the same as the selection color. – Keshu R. Jan 27 '20 at 09:18
  • @KeshuR. no, it is a different color. It is the same color of the accessoryView background color where you can see the selection – Gianni Jan 27 '20 at 10:07
  • can you please show your code ??? – Nayan Dave Jan 27 '20 at 10:36
  • 1
    @NayanDave the only code is `favouriteCell.contentView.superview?.backgroundColor = favouriteCell.contentView.backgroundColor` and I have changed the background color of both the cell and its content view to Default (Table Cell Grouped Background Color) in the StoryBoard – Gianni Jan 27 '20 at 10:43
  • @KeshuR. I have added a screenshot of the cell selection – Gianni Jan 27 '20 at 11:02
  • where have you put that code ?? and it does not make sense.. – Nayan Dave Jan 27 '20 at 11:32
  • 1
    @NayanDave the code is in `tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath)` and I have added it to force the accessoryView to have the same background color as seen here: https://stackoverflow.com/questions/3484511/altering-the-background-color-of-cell-accessoryview-and-cell-editingaccessoryvie – Gianni Jan 27 '20 at 11:42
  • is your `UITableView` is static or dynamic ? , if it's dynamic then what have you wrote in the `cellForRowAt` delegate function ??? – Nayan Dave Jan 27 '20 at 11:57
  • 1
    @NayanDave it is static, grouped – Gianni Jan 27 '20 at 12:03
  • and you've added accessory view with `storyboard` or ???? – Nayan Dave Jan 27 '20 at 12:10
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/206714/discussion-between-nayan-dave-and-gianni). – Nayan Dave Jan 27 '20 at 12:15

1 Answers1

0

The problem is due to a bug: the app doesn't register background color changes of the cell if done in the storyboard

Gianni
  • 135
  • 12