简体   繁体   English

双导航栏

[英]Double navigation bar

Here is my unwanted double navigation bars: 这是我不需要的双导航栏:

在此处输入图片说明

In storyboard, the link is like this: 在情节提要中,链接是这样的:

  1. A segue from the tabbar controller to this friendzone viewController 从Tabbar控制器到此Friendzone ViewController的序列
  2. friendzone VC is embedded in a navigation controller. friendzone VC嵌入在导航控制器中。

My navigation controller top bar is set to inferred, and friendzone VC top bar is set to hidden. 我的导航控制器顶部栏设置为推断,而Friendzone VC顶部栏设置为隐藏。 I have removed all kinds of configuration to the navigation bar(like navigationItem.leftbarbutton, translucent etc). 我已经删除了导航栏的所有配置(例如navigationItem.leftbarbutton,半透明等)。 There are four other tabItems in the tab bar controller, where three of them is embedded in a navigation controller. 标签栏控制器中还有其他四个tabItem,其中三个嵌入在导航控制器中。 I have found similar problems on stackoverflow, but none of the answers is working for this case. 我在stackoverflow上发现了类似的问题,但是在这种情况下,没有任何答案有效。

Update: The only code I have in friendZone viewcontroller considering the navigation bar is this in viewWillAppear(): 更新:考虑到导航栏,我在friendZone viewcontroller中唯一的代码是viewWillAppear()中的代码:

self.navigationController?.toolbarHidden = true
self.navigationController!.navigationBar.setBackgroundImage(colorImage,forBarMetrics: UIBarMetrics.Default)
self.navigationController!.navigationBar.shadowImage = colorImage
self.navigationController!.navigationBar.translucent = true

Update: An image of the storyboard . 更新: 情节提要的图像。 If I subclass my navigation controller and call this in viewDidLoad: 如果我将导航控制器子类化并在viewDidLoad中调用它:

self.setViewControllers([homeViewController], animated: true)

so the homeViewController first gets loaded by storyboard segue, then with code the first homeViewController will have double navigation bar, but the second have just one 因此,homeViewController首先通过情节提要脚本加载,然后使用代码,第一个homeViewController将具有双导航栏,而第二个只有一个

I had the same issue using a tabbarcontroller and a navigation controller. 使用tabbarcontroller和导航控制器时,我遇到了相同的问题。

The storyboard editor doesn't change anything when you change things there. 当您更改情节提要时,情节提要编辑器不会更改任何内容。 At runtime test options won't be validated. 在运行时,不会验证测试选项。

What i did: 我做了什么:

self.navigationController?.toolbarHidden = true

In your viewDidLoad() 在你的viewDidLoad()

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

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