嵌入在容器视图中的tableView顶部的空白 [英] White space at top of tableView embedded in a container view

查看:99
本文介绍了嵌入在容器视图中的tableView顶部的空白的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个viewController,其中有x 2个容器视图,其中包含x 2个不同的tableViews.我在主视图的顶部使用segmentControl在这两个tableViews之间切换.它工作正常.

I have a viewController that has x 2 container views in it that hold x 2 different tableViews. I use a segmentControl at the top of the main view to switch between these two tableViews. It works just fine.

在其中一个要查看的tableView上,我将向下钻取以显示另一个tableView.问题是,当我这样做时,该视图曾经在该段所在的视图顶部留有空白(至少我认为这是导致空白的原因.)

On one of the tableViews I want to drill down to show yet another tableView. Problem is, when I do it leaves a blank white space at the top of the view where the segment used to be (at least I think that is what is causing the white space.)

如何确保tableView紧贴在导航栏下方?

How do I ensure the tableView sits snuggly under the navigation bar?

以下是一些图片供参考:
1.主视图是否包含段控件.
2.是容器视图.

Here are some images for reference:
1. Is the main view containing a segment control.
2. Is the container view.

选择一个细分会弹出一个如下图所示的视图.没关系.

Selecting a segment brings up a view like the one below. Which is fine.

但是当我向下钻取时,我得到了:

But when I drill down I get this:

我可以向上滚动,没问题,然后将图像手动放在导航栏下面,因此这告诉我它的视图不够大.

I can scroll up, no problem, and manually place the image under the nav bar, so this tells me its not that the view is not big enough.

如何删除图片上方的空白?

How do I remove that white space above the image?

谢谢.

推荐答案

在您的EventDetailVC中,将这些行添加到viewDidLoad方法中

In your EventDetailVC add these line in viewDidLoad method

self.automaticallyAdjustsScrollViewInsets = false

如果无法解决,请将navigationBartranslucent属性设置为true

If it not solve set translucent property of navigationBar to true

self.navigationController.navigationBar.translucent = true

这篇关于嵌入在容器视图中的tableView顶部的空白的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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