[英]I've added a view within a UITableView and there is a gap between the view and the first cell. How can I remove it?
I've added a view to a tableView and there is a gap between the view which is 44px high and the first cell. 我已经将一个视图添加到tableView中,并且在高44px的视图与第一个单元格之间存在间隙。
Here's a screen shot from IB: 这是IB的屏幕截图:
I've tried a few things such as changing the heightForHeaderInSection's value and also disabled adjust scroll view insets. 我已经尝试了一些操作,例如更改heightForHeaderInSection的值,还禁用了调整滚动视图插图。 None of these work properly. 这些都不正常。 The view seems to be within the tableView and scrolls with it. 该视图似乎在tableView中,并随其滚动。
This is how things are looking in simulator: 这是模拟器中的外观:
Would appreciate some help here as I don't understand what exactly is causing this gap. 在此感谢您的帮助,因为我不知道是什么导致了这种差距。
Thanks for your time 谢谢你的时间
A great way to debug these types of problems is to set a background color. 调试这些类型的问题的一种好方法是设置背景颜色。 You could set the cells to red and the view to green. 您可以将单元格设置为红色,将视图设置为绿色。 It would then be interesting to see if the red and green edges are flush with no white in between. 这样一来,看看红色和绿色边缘是否齐平且中间没有白色,就很有趣了。
Based on your screenshot, it looks like nothing is wrong. 根据您的屏幕截图,看来没有什么错。 And by that I mean it looks about right for a view height of 44 points and a cell immediately beneath it with no separator line above it (so it's hard to tell where one ends and the other begins). 而且,我的意思是,对于44点的视图高度来说,它看起来正确,并且在其下面一个单元格上面没有分隔线(因此,很难说出一端在哪里,另一端在哪里开始)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.