iosswiftuitableviewuitableviewsectionheader

Same RGB but different color for cell, header background in TableView


I have a headerView for a cell and a cell containing a collectionView. I wish to make both have a background color of

UIColor(red: 0.898, green: 0.898, blue: 0.898, alpha: 1.0)

I set both headerView's background color and the cell and its collectionView's background color with the color above. However, when I run the code, I get a little contrast in color between the headerView and the tableView cell. I'm not sure why. I used the same UIColor.

enter image description here

You can see the subtle difference.


Solution

  • You also need to check out cell contentView, cells and its content views for your collection view.

    If this still doesn't help, try examining the view hierarchy to check which view background wasn't changed.