简体   繁体   English

SideMenu 警告:尝试在 swift 中从它的 navigationController == nil 的位置推送一个视图控制器

[英]SideMenu Warning: attempt to push a View Controller from where its navigationController == nil in swift

I have added jonkykong/SideMenu pod in my project.我在我的项目中添加了jonkykong/SideMenu pod。 if I am adding viewcontrollers in sidemenu then it is working fine.如果我在侧边菜单中添加视图控制器,那么它工作正常。

Given segue present modelly from all sidemenubutton in viewcontroller to UISideMenuNavigationController鉴于从视图控制器中的所有侧边菜单按钮到 UISideMenuNavigationController 的模型呈现

If I add all viewControllers in sidemenu then its working fine but if I go like below :如果我在 sidemenu 中添加所有 viewControllers 那么它工作正常但如果我像下面这样:

UISideMenuNavigationController -> home(is a collectionview) -> MakePaymentViewController -> PaymentOptionsViewController

in home deselect:在家里取消选择:

let nextViewController = self.storyboard?.instantiateViewController(withIdentifier: "MakePaymentViewController") as? MakePaymentViewController
self.navigationController?.pushViewController(nextViewController!, animated: true)

In MakePaymentViewController makePaymentButton:在 MakePaymentViewController makePaymentButton 中:

let makepayVC = self.storyboard?.instantiateViewController(withIdentifier: "MakePaymenyOptionsViewController") as! MakePaymenyOptionsViewController
makepayVC.amounText = totalAmount
self.present(makepayVC, animated: true)

and if I give segue present modelly from MakePaymenyOptionsViewController's sidemenu button to UISideMenuNavigationController then I am getting below error如果我从 MakePaymenyOptionsViewController 的 sidemenu 按钮到 UISideMenuNavigationController 模型地提供 segue 呈现,那么我得到以下错误

I don't want MakePaymenyOptionsViewController in sidemenu.我不想在侧边菜单中使用 MakePaymenyOptionsViewController。

SideMenu Warning: attempt to push a View Controller from Optional() where its navigationController == nil. SideMenu 警告:尝试从 Optional() 推送一个视图控制器,其中它的 navigationController == nil。 It must be embedded in a Navigation Controller for this to work.它必须嵌入到导航控制器中才能工作。

MakePaymenyOptionsViewController必须嵌入到 NavigationController 中才能使其工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM