单元格的 RGB 相同但颜色不同,TableView 中的 header 背景

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

我有一个单元格的 headerView 和一个包含 collectionView 的单元格。我希望两者的背景颜色都为

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

我将 headerView 的背景色和单元格及其 collectionView 的背景色都设置为上面的颜色。但是,当我 运行 代码时,我在 headerView 和 tableView 单元格之间得到了一点颜色对比。我不确定为什么。我使用了相同的 UIColor。

你可以看出细微的差别。

您还需要检查单元格 contentView、单元格及其集合视图的内容视图。

如果这仍然没有帮助,请尝试examining the view hierarchy检查哪个视图背景没有改变。