简体   繁体   中英

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.

在此处输入图片说明

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. To do this you can launch it on you device(or on simulator), click 'Debug View Hierarchy' button.

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... :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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