行和节之间的UITableView空间

时间:2015-09-08 11:17:14

标签: ios swift uitableview

我想让UITableView尽可能靠近iOS设置视图:

enter image description here

如何在不同部分之间创建空间?什么是最好的方式?

5 个答案:

答案 0 :(得分:10)

您只需在界面生成器中选择分组样式,它将按部分分隔表格,类似于屏幕截图。

这是附件:

enter image description here

答案 1 :(得分:2)

将UITableView的样式更改为“Grouped”

答案 2 :(得分:1)

尝试这些..

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
  return 30; //according to your need..
}

我希望它有所帮助......

答案 3 :(得分:1)

首先,iOS设置不使用ViewForSection,否则Section视图将放在顶部tableView中。

您可以为该特定indexPath返回一个空的containerView单元格并在其中停止didSelect,但请记住将空单元格包含在您用于其他单元格的数组中。

答案 4 :(得分:0)

只需根据需要在表格中添加页脚高度:

func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
    return 44
}
相关问题