gpt4 book ai didi

ios - UITableViews 之间的间距,如设置应用程序

转载 作者:搜寻专家 更新时间:2023-10-30 22:29:31 25 4
gpt4 key购买 nike

我是 iOS 开发新手,我希望某些单元格之间有间距,就像官方设置应用程序那样。

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

如果我有更多的 TableView,屏幕就不能完全滚动,可能不是所有的都能显示。

最佳答案

要实现一个看起来像设置中的 TableView,您必须将 TableViewStyle 设置为 Grouped 并使用 Sections 来分隔/分组一组特定的 TableViewCells

Set TableView Style to "Grouped"

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

func numberOfSections(in tableView: UITableView) -> Int {
return myNumberOfSections
}

有关 numberOfSections 的更多信息,请查看 UITableViewDataSource代表。

关于ios - UITableViews 之间的间距,如设置应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40326864/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com