移除UITableView分组的插页上方的空间。

问题描述 投票:0回答:1

我有一个带导航栏的表视图控制器。我的表视图是一个插入式分组表视图,我为每个部分都设置了标题。我试图删除表视图标题上方的空间。这是我的表格视图。enter image description here我该怎么做呢?

我已经试过了。

func tableView(tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
    return 0.1
}

但这行不通

ios swift xcode uitableview
1个回答
0
投票

试着从你的tableviewcontroller中删除viewForHeaderInSection方法,它应该会帮助你。

override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView?

有了这个方法,它看起来像

enter image description here

而没有

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.