简体   繁体   English

我在UITableView中添加了一个视图,该视图与第一个单元格之间存在间隙。 如何删除?

[英]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.

相关问题 如何增加UITableView节标题视图和第一个单元格之间的距离? - How do I increase the gap between a UITableView section headerview and first cell? 水平集合视图在单元格上方具有空间。 如何删除它? - Horizontal collection view has space above cell. How to remove it? 我如何在表格视图单元格之间绘制这条线。 现在我只设置背景图像,但单元格大小会增加或减少 - How can i draw this line between the tableview cell. For now i just set a background image but cell size will be increase or decrease 如何删除tableview标头和第一个单元格之间的空间? - How can I remove space between tableview header and first cell? UITableVie 中的 UIStackView 作为一个单元格。 堆栈视图内容被截断 - UIStackView within UITableVie as a cell. The stack view contents gets truncated 在转换集合视图单元格的pdf的第一页时,代码创建黑盒子。 怎么解决这个问题? - Code creating black box when converting first page of a pdf for a collection view cell. How to get around this? 我可以将页面视图控制器放在表格视图单元格中吗? - Can I put a page view controller within a table view cell? 如何根据用户在上一个视图中选择的单元格来自定义用户看到的 UITableView? - How can I customize the UITableView that users see depending on which cell in the previous view they chose? 如何从分组的uitableview部分添加/删除单元格? - How can I add/remove a cell from grouped section uitableview? 我在 Tableview 单元格中有 collectionView 。 它总是返回零。 我该如何解决? - I have collectionView inside of Tableview cell. It return always Zero. How can I solve it?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM