1

Here is my unwanted double navigation bars:

enter image description here

In storyboard, the link is like this:

  1. A segue from the tabbar controller to this friendzone viewController
  2. friendzone VC is embedded in a navigation controller.

My navigation controller top bar is set to inferred, and friendzone VC top bar is set to hidden. I have removed all kinds of configuration to the navigation bar(like navigationItem.leftbarbutton, translucent etc). There are four other tabItems in the tab bar controller, where three of them is embedded in a navigation controller. I have found similar problems on stackoverflow, but none of the answers is working for this case.

Update: The only code I have in friendZone viewcontroller considering the navigation bar is this in 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:

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

Stav1
  • 132
  • 2
  • 11

1 Answers1

1

I had the same issue using a tabbarcontroller and a navigation controller.

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()

SamuelD
  • 333
  • 2
  • 10
  • when i set toolbarHidden = true there is still 2 navigation bars! – Stav1 Dec 03 '15 at 11:35
  • Can you try to set status bar to none in the simulated metrics ? – SamuelD Dec 03 '15 at 11:43
  • If I set the Navigation controllers´ top bar to none, none of them is visible – Stav1 Dec 03 '15 at 11:50
  • You have somewhere where you add it twice? Can you update and post your code ? – SamuelD Dec 03 '15 at 11:52
  • No I dont think I do. But it seems to be a problem with the translucent = true. If i set the navigation bar to opaque, and then back to inferred in storyboard, i get only one bar. If i set to translucent and then back to inferred i get two. So strange... Opaque is working, sadly i want translucency – Stav1 Dec 03 '15 at 12:29
  • Can you check if you extend your edges under top bars ? It is in the same right hand menu as the display metrics. In de veiwcontroller section, you will see a checkbox with extend edges under top bars. Is it checked? – SamuelD Dec 03 '15 at 12:30
  • it is checked in both the viewcontroller and in the navigation controller. – Stav1 Dec 03 '15 at 12:35
  • i don't manage to find it myself and i can't recreate your problem... Someone with the same problem: http://stackoverflow.com/questions/11199227/unwanted-double-navigation-bar – SamuelD Dec 03 '15 at 12:56
  • Thanks for trying! Ive tried printing self.navigationcontroller.viewcontrollers, and it only prints one VC – Stav1 Dec 03 '15 at 15:05