ios - 从 UIView 子类推送导航 Controller 会导致崩溃

标签 ios objective-c uiview uinavigationcontroller

我有一个 UIView 子类,如果点击其中的按钮,它必须将 viewController 推送到导航堆栈上。所以我在我的 appDelegate 中保留了导航 Controller 的副本。然后我从按钮的操作方法中执行以下操作:

[appDelegate.navigationController pushViewController:nextViewController animated:YES]; 

这会导致应用程序在 nextViewController 弹出时崩溃。当我按照更标准的方法从 UIView 子类发布通知、在父 View Controller 中接收它并从那里推送 nextViewController 时,此问题已得到解决。

为什么会这样?

最佳答案

[self.navigationController pushViewController:nextViewController animated:YES];

试过这个代码....

关于ios - 从 UIView 子类推送导航 Controller 会导致崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20545138/

相关文章:

ios - 应用程序的 Info.plist 必须包含 NSMotionUsageDescription 键

iphone - 在 Objective-C 中使用数组试图简化大量重复代码

ios - 将图像保存到相册时出现 NSInvalidArgumentException

ios - 如何快速修复横向模式下的约束?

ios - View 不粘在顶部(不改变位置)

ios - Xcode UIView 没有边框颜色等成员

ios - 在 SwiftUI 的 MapView 中检测长按

ios - 返回整个数据库的复合查询

ios - 从 Presentmodelview 堆栈中移除 UIViewcontroller

ios - for循环结束后的调用方法