我在我的项目中添加了 jonkykong/SideMenu
pod。如果我在侧菜单中添加 View Controller ,那么它工作正常。
给定从 View Controller 中的所有侧菜单按钮到 UISideMenuNavigationController 的 segue 模型
如果我在侧菜单中添加所有 viewController,那么它工作正常,但如果我如下所示:
UISideMenuNavigationController -> home(是一个 Collection View ) -> MakePaymentViewController -> PaymentOptionsViewController
在主页取消选择:
let nextViewController = self.storyboard?.instantiateViewController(withIdentifier: "MakePaymentViewController") as? MakePaymentViewController
self.navigationController?.pushViewController(nextViewController!, animated: true)
在 MakePaymentViewController makePaymentButton 中:
let makepayVC = self.storyboard?.instantiateViewController(withIdentifier: "MakePaymenyOptionsViewController") as! MakePaymenyOptionsViewController
makepayVC.amounText = totalAmount
self.present(makepayVC, animated: true)
如果我从 MakePaymenyOptionsViewController 的侧菜单按钮向 UISideMenuNavigationController 提供 segue 模型,那么我会收到以下错误
我不想在侧边菜单中使用 MakePaymenyOptionsViewController。
SideMenu Warning: attempt to push a View Controller from Optional() where its navigationController == nil. It must be embedded in a Navigation Controller for this to work.
最佳答案
MakePaymenyOptionsViewController
必须嵌入到 NavigationController 中才能正常工作。
关于ios - 侧边菜单警告 : attempt to push a View Controller from where its navigationController == nil in swift,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59109078/