简体   繁体   English

swift - UITableView 部分插入

[英]swift - UITableView section insets

I have design the screen like below image.我设计了如下图所示的屏幕。

在此处输入图片说明

I wonder how I can inset margin in section like a blue area.我想知道如何在像蓝色区域一样的部分插入边距。

These are not cell spacing, header or footer height, layout margin.这些不是单元格间距、页眉或页脚高度、布局边距。

You could have the cell's contentView 's backgroundColor set to clear and setup your UI elements however you want.您可以将单元格的contentViewbackgroundColor设置为根据需要clear和设置您的 UI 元素。 That way it'll look as if the cell is indented.这样它看起来好像单元格是缩进的。

Don't try to inset your whole TableView / TableViewCell .不要试图插入整个TableView / TableViewCell Create a container View inside your TableViewCell instead.而是在 TableViewCell 内创建一个容器视图。 And set margin for inner UIView并为内部UIView设置边距

Currently, you can't do it with UITableView.目前,你不能用 UITableView 做到这一点。 There is no API for section insets.部分插图没有 API。

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

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