1. 隐藏Grouped TableView上边多余的间隔
静态 Grouped UITableViewController,第一个 Section 距离屏幕顶端有间隔
这里其实是一个被 UITableView 默认填充的 HeaderView(如果需要使用headerView的话,直接填高度就可以了)。而且,当试图将它的高度设置为 0 时,完全不起效果。但我们用下面的代码创建一个高度特别小的 HeaderView 时,上面的边距就不见了:

如果是用Storyboard的话就更简单了:
-
首先在第一个section上拖过来一个空的view
Paste_Image.png
然后选中这个View 的Runtime Attributes栏,添加一个keyPath:

然后回车,就可以了!
网友评论