Search code examples
iosswiftuinavigationcontrolleruinavigationbaruinavigationitem

IOS: Navigation bar disappears after push segue


stroyboard

Every time I perform my show(push) segue the articles VC does not have its navigation bar present to display the title or the back button. I have also checked if the navigation controller has a title as that seemed to be the solution to some cases. The class that performs the segue just sends information. Categories is an enumeration.

enter image description here


Solution

  • You have to wrap your articleVC with another NavigationController. Or instead of using segue, you can push it with navigation controller to reuse the NavigationBar.

    let yourArticleViewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "articleViewControllerIdentifier") as! ArticleViewController
    self.navigationController?.pushViewController(yourArticleViewController, animated: true)