gpt4 book ai didi

ios - 侧边菜单警告 : attempt to push a View Controller from where its navigationController == nil in swift

转载 作者:行者123 更新时间:2023-11-29 05:16:48 29 4
gpt4 key购买 nike

我在我的项目中添加了 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/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com