简体   繁体   English

iOS:表格视图的标题栏被导航栏意外覆盖

[英]iOS: table view's title bar covered by navigation bar unexpectedly

I'm developing a simple UI for an iOS app. 我正在为iOS应用开发一个简单的UI。 what I've done is I developed it into a table view which has a navigation controller associated to it and had it laid out in Storyboard. 我要做的是将其开发为表格视图,该表格视图具有与之关联的导航控制器,并将其布置在情节提要中。

Everything seems working fine, except the navigation bar accidentally cover the view's title bar "Click to select item" as shown in the pictures below. 一切似乎工作正常,除了导航栏意外覆盖视图的标题栏“单击以选择项目”,如下图所示。

  1. the first picture is when it first shows on the screen. 第一张图片是它第一次在屏幕上显示时。
  2. the second one illustrates when I drag the title bar off the covering navigation bar. 第二个图例说明了何时将标题栏从覆盖的导航栏上拖动。

what do i do to get completely rid of this? 我该怎么做才能完全摆脱这种情况?

不幸的是,我的标题栏在导航栏下方

当我向下移动标题时

在此处输入图片说明

In Interface Builder, select your view controller and on the attributes inspector turn off Layout: Wants Full Screen. 在Interface Builder中,选择视图控制器,然后在属性检查器上关闭Layout:Wants Full Screen。 Then, your layout will automatically adjust its size to make room for the navigation bar. 然后,您的布局将自动调整其大小以为导航栏腾出空间。

Add this code in your viewDidLoad method 将此代码添加到您的viewDidLoad方法中

self.navigationController?.navigationBar.translucent = false

It works for me, since you've the same problem with me, I think it's work for you as well. 它对我有用,因为您对我也有同样的问题,所以我认为对您也一样。

您要隐藏导航栏的位置使用此行

self.navigationController.hidden = YES;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM