Search code examples
iossegueuistoryboardseguenavigationbar

Navigation bar disappears in a push segue loop


I am using Storyboards

I have 3 view controllers (A, B, and C) that I want to have arranged, so that each one segues into another; like a directed triangle.

A is reached from another controller (lets call it A'), it segues into B, and that segues into C; and I want C to segue back to A.

A' is embedded into a navigation controller, and so A,B and C have a bar as well. However when I make a segue from C to A, that bar disappears from all three view controllers.

How do I prevent this from happening? Should I add a UINavigationBar to each of the 3 controllers?


Solution

  • I actually figured this solution a while back, completely forgot about this question. In the storyboard, select the view controllers you are having issues with and, in the Attributes Inspector, change the Top Bar setting to a specific type of navigation bar rather than Inferred. This keeps the bar visible at all times for the corresponding UIViewController

    I assume, of course, you have a segue path that contains a UINavigationController somewhere before your respective controllers. I'm not sure if it would work without one.