1

我正在使用https://github.com/jonkykong/SideMenu 它工作正常,但是,我想覆盖堆栈。

例如,我有下一个流程?:

HomeViewController> MyBusinessViewController> TheBusinessXViewController> Add CategoryViewController> MyBusinessViewController(再次)。

但是,当我回到 时MyBusinessViewControllerBack Button正在重定向到上一个ViewController,但我想删除所有堆栈并在那里有初始菜单(就像 一样HomeViewController)这可能吗?

要有更自然的行为。

4

1 回答 1

0

要排除Add CategoryViewController到流程中,我们需要考虑:Add CategoryViewController完成后,您希望拥有: HomeViewController> MyBusinessViewController>TheBusinessXViewController

TheBusinessXViewController将是要显示的控制器,然后:

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)
于 2017-10-24T01:08:59.867 回答