在UIView里面的UITableView上方空白色空间 [英] Empty white space above UITableView inside a UIView

查看:170
本文介绍了在UIView里面的UITableView上方空白色空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将ViewView放置在ViewController视图中,但在导航栏底部和表格顶部之间留出44个高度差距。然后我想在该间隙中放置一个UITextField作为固定标题。出于某种原因,TableView在Prototype Cells的开头上方有一个空白空格。它只是白色的空间。以下是故事板中的内容。

I'm trying to position a TableView inside my ViewController view but leaving a 44 height gap between the bottom of the navigation bar and the top of the table. I then wanted to place a UITextField inside that gap to act as a stationary header. For some reason, the TableView has an empty white space above the start of the "Prototype Cells". Its just white space. Here is what it looks like in the storyboard.

查看应用程序显示时,它看起来像这样:

When viewing the app display, this is what it looks like:

滚动表格时,它一直向上移动到正确的地方:

When scrolling the table, it goes all the way up to the correct place:

推荐答案

尝试查看Participants ViewController的属性检查器(在右侧菜单中)。
选中'Extend Edges'选项并取消选中Under Top Bars,然后重新定位您的tableview。

Try to look in the 'attribute inspector' (in the right menu) of the Participants ViewController. Check for the option 'Extend Edges' and uncheck the 'Under Top Bars', and then relocate your tableview.

另一种可能的解决方案是取消选中'调整滚动视图插图'选项。
原因是当viewController扩展其边缘时,让我们说在顶部栏下,tableView的scrollView会自动调整其inset top,这样tableView的内容将从顶部栏开始。但在你的情况下,这是不需要的,因为你的tableView本身在条形码下面开始。

Another possible solution is to just uncheck the option 'Adjust Scroll View Insets'. The reason is that when the viewController extends its edges, let's say under the top bar, the tableView's scrollView automatically adjusts its inset top, so that the content of the tableView will start exactly under the top bar. But in your case this is not needed, since your tableView itself starts under the bar.

专注于ViewController并进入Attribute Inspector选项卡:

Focus on the ViewController and got to the Attribute Inspector tab:

这篇关于在UIView里面的UITableView上方空白色空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆