简体   繁体   English

静态表格视图单元格:颜色不对应

[英]Static table view cells: Clear color not corresponding

I have the below controller with the cell's, content view's, and table view's backgroundColor set to .clear , however, there is still a white background which I can't figure out what it is corresponding to. 我在下面的控制器中将单元格,内容视图和表视图的backgroundColor设置为.clear ,但是,仍然有一个白色背景,我不知道它对应什么。

在此处输入图片说明

It is due to Your table view cell colour. 这是由于您的表格视图单元格颜色。

Select table view cell: 选择表格视图单元格:

在此处输入图片说明

Set its background colour as clear. 将其背景颜色设置为透明。

在此处输入图片说明

I suggest you to debug it in your Xcode. 我建议您在Xcode中调试它。 To do this you can launch it on you device(or on simulator), click 'Debug View Hierarchy' button. 为此,您可以在设备(或模拟器)上启动它,单击“ Debug View Hierarchy”按钮。

Then by Mouse Click + Dragging on the screen rectangle you can rotate all layers of your screen and see which view is causing that white background. 然后通过鼠标单击+拖动在屏幕矩形上,您可以旋转屏幕的所有层,并查看导致该白色背景的视图。

this white background is due to table view cell select table view cell and from navigator make its background clear. 此白色背景是由于表格视图单元格选择表格视图单元格,并通过导航器使其背景清晰。 or you can do it in 或者你可以在

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

图片在这里

this will solve your problem... :) 这将解决您的问题... :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM