侧边菜单覆盖特定情况下的后退按钮
Side Menu override back button for specific cases
我正在使用 https://github.com/jonkykong/SideMenu
它工作正常,但是,我想覆盖堆栈。
比如我有下流量?:
HomeViewController
> MyBusinessViewController
> TheBusinessXViewController
> Add CategoryViewController
> MyBusinessViewController
(再次)。
但是,当我回到 MyBusinessViewController
时,Back Button
正在重定向到之前的 ViewController
,但我想删除所有堆栈并在那里保留初始菜单(像HomeViewController
一样)
这可能吗?
行为更自然。
要将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)
我正在使用 https://github.com/jonkykong/SideMenu 它工作正常,但是,我想覆盖堆栈。
比如我有下流量?:
HomeViewController
> MyBusinessViewController
> TheBusinessXViewController
> Add CategoryViewController
> MyBusinessViewController
(再次)。
但是,当我回到 MyBusinessViewController
时,Back Button
正在重定向到之前的 ViewController
,但我想删除所有堆栈并在那里保留初始菜单(像HomeViewController
一样)
这可能吗?
行为更自然。
要将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)