1

I want to display a navigation controller programmatically. This code works perfect on iOS 8, but on iOS 9 it doesn't work.

var vc = storyboard?.instantiateViewControllerWithIdentifier("view_controller_id") as! UIViewController;
var nc = UINavigationController()
        nc.setViewControllers([vc], animated: false)
        navigationController?.pushViewController(nc, animated: true)

After that I am getting this error

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Pushing a navigation controller is not supported'

HaveNoDisplayName
  • 8,291
  • 106
  • 37
  • 47
Slavik Voloshyn
  • 647
  • 10
  • 20
  • http://stackoverflow.com/questions/17757072/pushing-a-navigation-controller-is-not-supported – pkc456 Oct 10 '15 at 10:46

1 Answers1

0

You can't push a navigation controller to another navigation controller. You will have to show your navigation view controller with viewcontrollers modally or just push your view controllers to the active navigation controller.

haluzak
  • 1,133
  • 3
  • 17
  • 31