2016-01-19 108 views
1

我正尝试在动态单元格之间添加空格。Swift中在tableviewcell之间添加空格

这是我的代码。我不明白为什么它不工作。

func tableView(tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { 
     return 50 
    } 
func tableView(tableView: UITableView, viewForFooterInSection section: Int) -> UIView? { 
     let footer = UIView() 
     footer.backgroundColor = UIColor.clearColor() 
     return footer 
    } 
+2

[UITableViewCells之间间距]的可能的复制(http://stackoverflow.com/questions/28598830/spacing-between-uitableviewcells) –

回答

1

您可以通过在部分设置你的numberOfRows为1,您numberofSections设置到填充细胞动态项目的数组实现这一目标。然后,您可以将页脚视图高度设置为您的desiered空间。

func tableView(tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { 
    return YOUR_DESIRED_SPACE_BETWEEN_CELLS 
} 
相关问题