我正在使用https://github.com/jonkykong/SideMenu 它工作正常,但是,我想覆盖堆栈。
例如,我有下一个流程?:
HomeViewController
> MyBusinessViewController
> TheBusinessXViewController
> Add CategoryViewController
> MyBusinessViewController
(再次)。
但是,当我回到MyBusinessViewController
时,Back Button
将重定向到上一个ViewController
,但我想删除所有堆栈并在那里有初始菜单(如作为HomeViewController
)
这可能吗?
拥有更自然的行为。
答案 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)