静态 table 视图单元格:清除颜色不对应

Static table view cells: Clear color not corresponding

我有下面的控制器,单元格的、内容视图的和 table 视图的 backgroundColor 设置为 .clear,但是,仍然有一个我不能的白色背景弄清楚它对应的是什么

我建议你在 Xcode 中调试它。为此,您可以在您的设备(或模拟器)上启动它,单击 'Debug View Hierarchy' 按钮。

然后通过鼠标单击并在屏幕矩形上拖动,您可以旋转屏幕的所有层并查看哪个视图导致了白色背景。

这个白色背景是由于 table 视图单元格 select table 视图单元格和导航器使其背景清晰。或者你可以在

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "YourCellIdentifier", for: indexPath) as! YourCellClass
    cell.backgroundColor = .clear
}

这将解决您的问题... :)

这是由于您的 table 视图单元格颜色。

Select table 查看单元格:

将其背景颜色设置为清晰。