0

I am pushing from a viewController to another instance of the same viewController using the following code. The viewController is the top view of the navigation stack in the storyboard:

let storyboard = UIStoryboard(name: "Main", bundle: nil)
if let vc2 = storyboard.instantiateViewController(withIdentifier: "MyViewController") as? MyViewController {
    self.navigationController?.pushViewController(vc2, animated: true)
}

When vc2 is pushed to for a moment the back left arrow and title of the backButton is visible but the arrow quickly disappears and only the title is left for the backButton.

I'm assuming that this is because the instantiated viewController is the topViewController in the storyboard.

I tried:

self.navigationItem.hidesBackButton = false

but this didn't work. Not sure how to make the back arrow (carat) be visible in this case. The backButton title continues to be displayed and pressing it correctly returns to the previous view.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
alionthego
  • 8,508
  • 9
  • 52
  • 125
  • I checked and not referencing or replacing the back button at all. The correct title is being automatically displayed. Just the arrow is not visible. – alionthego Apr 12 '17 at 13:02

1 Answers1

1

just try this

self.navigationItem.leftBarButtonItem = nil

If it doesn't work then check appearance color of navigation

Vinod Kumar
  • 3,375
  • 1
  • 17
  • 35