嵌入另一种观点的UITableView有节头的错位置 [英] UITableView embedded in other view has wrong position of section header

查看:173
本文介绍了嵌入另一种观点的UITableView有节头的错位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有嵌入另一种观点认为,像这样的UITableView:

I have a UITableView embedded in another view like so:

导航控制器模态显示,这样它的布局应该是全屏幕,而不是依赖于故事板的任何其他部分。
如果已经设置了像这样固定的自动布局约束纵断面图的上半部分:

The navigation controller is displayed modally, so its layout should be full screen and not depend on any other parts of the storyboard. If have set up the upper part of the profile view with fixed auto-layout constraints like so:


  • 顶部布局指南图像视图(灰色的):20pt

  • 图像视图为交易的标签:20pt

  • 交易标签,容器视图:20pt

  • 容器以底部布局的引导距离,开头和结尾的空间:所有0pt

所以基本上,当屏幕较大,容器视图应填写的剩余空间。

So basically, when the screen is larger, the container view should fill the remaining space.

在容器观点,我嵌入表视图(包括相应的​​控制器)。为了使问题更加明显,我给了容器查看绿色背景和表查看蓝色的(这就是为什么部分的标题是略带蓝色)。当然,我希望表视图填满整个容器视图。但是,这只是发生部分:

In the container view, I embedded a Table View (including the appropriate controller). To make the issue more visible, I gave the container view a green background and the table view a blue one (that's why the section heading is slightly blue). Of course, I would expect the table view to fill the entire container view. But this only happens partially:

所以表视图确实填写完整的容器视图(表视图的背景色为蓝色),但节头被定位为低。如果我向下滚动,节头停留在相同的位置,但在细胞向上移动,它上面的被显示:

So the table view does fill the complete container view (the table view's background color is blue) but the section header is positioned to low. If I scroll down, the section header stays at the same position, but the cells move up and are displayed above it:

我已经尝试过检查和取消选中扩展边缘控制是否扩展表视图控制器的复选框根据热门酒吧,在底部的酒吧和不透明下栏,但这并没有帮助。它看起来好像表视图留出空间的导航栏和状态栏,但它不应该,我不明白我怎么可以把它铺陈节头和细胞正常。

I already tried checking and unchecking the "Extended Edges" checkboxes of the table view controller that control whether it extends "Under Top Bars", "Under Bottom Bars" and "Under Opaque Bars", but that did not help. It looks as if the table view leaves space for the navigation bar and status bar, but it shouldn't and I don't understand how I can make it lay out the section header and cells correctly.

任何想法这是为什么,我该如何解决?

Any ideas why that is and how I can fix it?

推荐答案

这可以通过取消在IB的根据热门酒吧框为拥有它的容器视图,而不是表视图控制器,该控制器是固定的。它似乎并不正确,你应该这样做,因为,你会认为其主视图(在容器控制器)的导航栏下延长不会使嵌入式表视图表现它的方式。

This can be fixed by unchecking the "Under Top Bars" box in IB for the controller that has the container view in it, not the table view controller. It doesn't seem correct that you should have to do this, since, you would think that having the main view (in the container controller) extend under the navigation bar wouldn't make the embedded table view behave the way it does.

这篇关于嵌入另一种观点的UITableView有节头的错位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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