繁体   English   中英

如何在表格视图单元格之间设置空间并消除背景contentView的白色

[英]How to set the space between table view cell and removing white color for background contentView

如何删除单元格和角落之间的白色,我在容器视图中使用了透明色,但没有删除白色。

我将自定义单元格放在表格视图上。 cell.contentView.backgroundColor = [UIColor clearColor]; cell.contentView.layer.cornerRadius = 10;

设置UITableView样式分组。 并将每个单元格设置在不同的部分。 然后在下面添加代码:

- (float)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    //this is the space
    return 50;
}

要更改单元格之间的颜色,您应该执行以下操作:

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
    UIView *v = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.tableView.frame.size.width, 5)];
    v.backgroundColor = [UIColor whiteColor];
    return v;
}

如果要更改背景颜色,则应在cell.contenrView.backgroundColor中设置所需的颜色。

暂无
暂无

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

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