ios - 如何设置表格 View 单元格之间的空间并删除背景内容 View 的白色

标签 ios objective-c uitableview

如何去除单元格和角落之间的白色我在容器 View 中使用了清晰的颜色,但没有去除白色。

我在表格 View 中使用自定义单元格。
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 中设置你需要的颜色。

关于ios - 如何设置表格 View 单元格之间的空间并删除背景内容 View 的白色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24062778/

相关文章:

iphone - 混淆 UIScrollView 和 setContentSize

ios - 你如何在 React Native 中获取框架的大小?

ios - Objective-C - iPhone : different DetailViewControllers for TableView?

ios - View Controller 在 iOS 7 中不旋转

ios - 正在获取YouTube api iOS的访问 token “Error”: “invalid_request”

objective-c - 无法插入操作连接 : could not find any information about the class XMTAppDelegate

iphone - 为什么我的 UIToolBar 会随着 UITableView 一起滚动?

ios - 如何在原型(prototype)单元格中使用 UIImageView 在 UITableView 中创建视差效果

ios - Swift xcode 如何添加内置箭头

ios - 如何使用 AutoLayout 在 NavigationBar 下方添加 UITableView?