Mike Mike - 5 months ago 42
Swift Question

How to navigate back from a navigation controller on the storyboard in xcode

I've got an initial view controller

with a button "List" (and a few other random buttons).

Clicking on "List" segues to a
that is embedded in a navigation controller. And that is all sweet.

But once the
is loaded there is no "back" button to navigate back to Initi

I was just wondering what my options were. On the storyboard I've used a "Navigation Item" and "Button Bar" and i'll hook that up programmatically to navigate back.

I just wasn't sure if an unwind segue was an option or if anyone had better ideas.


Answer Source

The reason you don't see a back button when your UITableViewController is loaded is because it is the root view controller for the navigation controller that it is embedded in. As such, the NavigationController has no other view controller in the stack that it can go back to.

Instead of the TableViewController, embed your InitialViewController inside a NavigationController and that should add a navigation bar with Back button to your TableViewController.

If you don't want to show the Navigation Bar in your InitialViewController, you can hide it using the following steps:

  1. In your storyboard file, select the InitalViewController
  2. Open the Attributes inspector and set Top Bar to None

Hope this helps!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download