Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Build a Playlist Browser with Swift Using a Navigation Controller With Segues Using Navigation Controllers

Navigation Bar Not Showing

I followed the video as mentioned but when building the project everything works properly except the Navigation Bar is not showing. I stopped the project, clicked the View Controller, then the Attributes inspector to see if anything looked odd and "Bar Visibility: Shows Navigation Bar" was checked but still not showing.

I looked at the documentation and added this line of code to my viewDidLoad() that did solve my project :

navigationController?.navigationBarHidden = false

Did anyone else have this issue?

1 Answer

Martin Wildfeuer
PLUS
Martin Wildfeuer
Courses Plus Student 11,071 Points

Hey there! So, I am not sure how your storyboard looks like, but that's where I'd look first. A standard navigation-/view controller setup would look like this:

Navigation Controller Setup

  • In the utilities section, open the attributes inspector for your navigation controller.
  • Navigation controller -> Bar visibility -> Shows navigation bar should be enabled.
  • Moreover, at Simulated metrics you can explicitly set how your Top bar should look like. In a standard setup inferred would show the navigation bar by default. The navigation bar style you choose here, should be inferred by all child view controllers by default, unless you define otherwise (in code, as you did, or storyboard).

That is, you can choose a navigation bar style for each child view controller individually, by choosing the child view controller accordingly and setting the Top bar in Simulated metrics.

Let me know if that helps!