侧面菜单覆盖特定情况的后退按钮

时间:2017-10-23 19:15:41

标签: ios swift side-menu

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

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

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

但是,当我回到MyBusinessViewController时,Back Button将重定向到上一个ViewController,但我想删除所有堆栈并在那里有初始菜单(如作为HomeViewController) 这可能吗?

拥有更自然的行为。

1 个答案:

答案 0 :(得分: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)