gpt4 book ai didi

iphone - 从一个 View 到同一类的另一个 View 的 UINavigation 崩溃,如何解决?

转载 作者:行者123 更新时间:2023-11-28 22:39:47 24 4
gpt4 key购买 nike

在我的项目中,有大约 10 个 View Controller 。在其中一个 View Controller 中,我在 xib 中又添加了一个 View Controller 以提供额外的功能(一个实际 View + 为单个类添加了 View Controller )。当我尝试将 ie.navigate 从其实际 View 移动到添加的 View Controller 时,对于第一次导航正常,也返回到实际 View 。但如果我再次去那个添加的 View Controller ,我的应用程序就会崩溃。这是显示的错误。

"Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Pushing the same view controller instance more than once is not supported (<UIViewController: 0xc09e460>)'
First throw call stack:
(0x30da012 0x28b4e7e 0xb9c5b0 0xb9c098 0xa7f3f 0xab327 0x28c86b0 0x5fcfb 0x28c86b0 0x706035 0x305df3f 0x305d96f 0x3080734 0x307ff44 0x307fe1b 0x33127e3 0x3312668 0xaa265c 0x719d 0x2685)
libc++abi.dylib: terminate called throwing an exception"

而我在代码中使用的方法action是

- ( void ) move {
[self.navigationController pushViewController:addedviewController animated:YES];
}

我还添加了屏幕截图... enter image description here

最佳答案

您不能添加已经在堆栈上的 View Controller 实例。为什么不在获得 addedViewController 实例之前将 Controller 从堆栈中弹出?

关于iphone - 从一个 View 到同一类的另一个 View 的 UINavigation 崩溃,如何解决?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14876410/

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