1

I'm using https://github.com/jonkykong/SideMenu And it's working ok, but, I wan to override the stack.

For example, I have the next flow?:

HomeViewController > MyBusinessViewController > TheBusinessXViewController > Add CategoryViewController > MyBusinessViewController (Again).

But, when I come back to the MyBusinessViewController, the Back Button is redirecting to the previous ViewController, but I want to delete all the stack and have the initial menu there (Like as the HomeViewController) Is that possible?

To have a more natural behavior.

Benjamin RD
  • 11,516
  • 14
  • 87
  • 157
  • 1
    You can set the `viewControllers` property of the navigation stack when you are ready to navigate to the `MyBusinessViewController` again so that the `viewControllers` property only includes the two arrays (HomeViewController > MyBusinessViewController) – MSU_Bulldog Oct 23 '17 at 19:48

1 Answers1

0

To exclude Add CategoryViewController to the flow, we need considerer this: After the Add CategoryViewController is completed, you want to have: HomeViewController > MyBusinessViewController > TheBusinessXViewController

TheBusinessXViewController will be the controller to display, then:

let nextVC = self.storyboard?.instantiateViewController(withIdentifier: "TheBusinessXVC") as! TheBusinessXViewController
        nextVC.id = self.idtruck
        nextVC.extraparameter = "StringOrInt"

        let newViewController = self.storyboard?.instantiateViewController(withIdentifier: "HomeVC") as! HomeViewController
        let sencondViewController = self.storyboard?.instantiateViewController(withIdentifier: "MyBusinessVC") as! MyBusinessViewController

        let customViewControllersArray : NSArray = [newViewController, sencondViewController, nextVC]
        self.navigationController?.viewControllers = customViewControllersArray as! [UIViewController]

        self.navigationController?.pushViewController(nextVC, animated: true)
Benjamin RD
  • 11,516
  • 14
  • 87
  • 157