locked
Switching between ViewController RRS feed

  • Question

  • User196637 posted

    Hello, I'm developing an iOS app and i want to switch between two separate ViewController and close the first one.

    i tried this code snippet

    NavigationController.PushViewController (new MainController (), true);

    where MainController is the second ViewController, but i get always 'System.NullReferenceException: Object reference not set to an instance of an object '

    How can i do the switching?

    Thursday, February 25, 2016 3:42 PM

Answers

  • User14802 posted

    You must define a UINavigationController as the root ViewController for the AppDelegate and define MainController as the starting ViewController, then you could use NavigationController.SetViewControllers() in your MainController to pass the second ViewController in the array of ViewControllers to replace the navigation stack.

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Thursday, February 25, 2016 10:26 PM