简体   繁体   English

使用情节提要设置tableview的静态单元格的行距

[英]set line spacing of static cells of tableview with storyboard

I want to know if there is a way to set the spacing between rows with static cells of tableview with storyboard. 我想知道是否有一种方法来设置带有情节提要的tableview静态单元格的行之间的间距。

I didn't find an attributor to do that: 我没有找到执行此操作的归因者:

在此处输入图片说明

I want to set the spacing between rows so it should like this: 我想设置行之间的间距,所以它应该像这样:

在此处输入图片说明

You cannot do that. 你不能这样做。 There are several options how you can deal with this. 有几种方法可以解决此问题。

  1. Simulate the separator in the cell itself (eg, see my question ). 在单元格中模拟分隔符(例如,参见我的问题 )。

  2. Use every other cell as a separator (so cell at row 0 will be normal cell, cell at row 1 will be a separator, cell at row 2 a normal cell, etc.). 使用其他所有单元格作为分隔符(因此,第0行的单元格为普通单元格,第1行的单元格为分隔符,第2行的单元格为普通单元格,依此类推)。

  3. Use section footers as a separators, in that case there will be section per every cell - numberOfSections will return number of all cells, numberOfRows will return 1. Then use footerForSection to provide appropriate "separator". 使用一节页脚作为分隔符,在这种情况下,将有每每一个细胞部分- numberOfSections将返回所有细胞的数量, numberOfRows将返回1然后使用footerForSection提供相应的“分隔符”。

Nothing in attribute inspector to do that , you can do it like that 在属性检查器中什么也没做,您可以那样做

contentView
     topView   ----- height(static) ---- white background
     spaceView ----- height (5) ---- gray background

Use UICollectionView 使用UICollectionView

UITableView don't provide spacing between rows UITableView不提供行间距

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

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