UITableViews之间的间距,如Settings Application

Dav*_*ave 5 iphone uitableview tableviewcell ios swift

我是iOS开发人员的新手,我希望在官方设置应用程序之间的某些单元格之间有间距.

有没有办法在一个TableView中执行此操作,还是必须插入更多的?

如果我有更多的TableViews,屏幕不能完全滚动,也许并非所有的都能显示.

d.f*_*ber 10

为了实现一个TableView看起来像一个在设置你必须设置Style你的TableViewGrouped,并使用Sections分离/分组一组特定的TableViewCells.

将TableView样式设置为

func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    return myNumberOfRows
}

func numberOfSections(in tableView: UITableView) -> Int {
    return myNumberOfSections
}
Run Code Online (Sandbox Code Playgroud)

有关更多信息,请numberOfSections查看 UITableViewDataSource委托.