使用故事板设置 tableview 静态单元格的行距

问题描述:

我想知道是否有办法设置带有故事板的tableview的静态单元格的行之间的间距.

I want to know if there is a way to set the spacing between rows with static cells of tableview with storyboard.

我没有找到这样做的归因者:

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. 模拟单元格本身中的分隔符(例如,请参阅我的问题).

使用每隔一个单元格作为分隔符(因此第 0 行的单元格将是普通单元格,第 1 行的单元格将是分隔符,第 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.).

使用节脚作为分隔符,在这种情况下,每个单元格都会有一个节 - numberOfSections 将返回所有单元格的数量,numberOfRows 将返回 1. 然后使用 footerForSection 提供适当的分隔符".

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".