简体   繁体   English

iPhone:如何保持分组表格视图的边框但将其背景设置为透明

[英]iPhone: how can I keep the borders of grouped tableview but set its background to transparent

I use a grouped tableview and custom cells which I load from nib.我使用从笔尖加载的分组表格视图和自定义单元格。 When I set the background colour of tableview to clearcolor then I can only see the contents of the cells but nothing about the tableview.当我将 tableview 的背景颜色设置为 clearcolor 时,我只能看到单元格的内容,但看不到 tableview。 I like the rounded corners and seperator lines of the gropued view, so I want to keep those lines and change the colours of the lines, but set the table's background colour transparent so I will see the main image of the window.我喜欢组合视图的圆角和分隔线,所以我想保留这些线条并更改线条的颜色,但将表格的背景颜色设置为透明,这样我将看到 window 的主图像。 is this possible?这可能吗?

So you wanted to change the color of separator lines所以你想改变分隔线的颜色

self.tableView.separatorColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1];

// give your hex color code or your color

Inside of viewDidLoad of your view controller you need to set the backgroundView to nil and the backgroundColor to clear.在视图 controller 的viewDidLoad内部,您需要将backgroundView设置为 nil 并将backgroundColor设置为清除。

self.tableview.backgroundView = nil;
self.tableview.backgroundColor = [UIColor clearColor];

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

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