ios - 当我按下后退按钮时出现 Uinavigation 错误

标签 ios objective-c iphone uinavigationcontroller uitabbarcontroller

第一个 vc( View Controller )有一个按钮,当我按下它时,我必须转到第二个 vc,它嵌入了标签栏 Controller 。请检查附加图像。

enter image description here

在按钮点击事件中,我这样调用标签栏:-

TabBarVC *vc=[self.storyboard instantiateViewControllerWithIdentifier:@"TabBarVC"];
[self.navigationController pushViewController:vc animated:YES];

现在,当我按下它时,它会根据需要转到标签栏,但会显示消息 :- “在意外状态下完成导航转换。导航栏 subview 树可能已损坏。”

现在,当我点击后退按钮时,应用程序崩溃并显示此错误消息:-

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Can't add self as subview'

可能的解决方案:- 这可能是因为我调用了嵌入在 secondvc 上的 tabbar Controller ... 我像这样将动画设置为是:-

[self.navigationController pushViewController:vc animated:NO];

所以现在应用程序没有崩溃,但是当我按下后退按钮时,它应该转到 firstvc,但它再次转到标签栏 Controller (相同的 View Controller )。如果我在后退按钮中单击 2 次,它会根据需要转到 firstvc。任何建议我怎样才能消除这个导航堆栈问题。

最佳答案

也许你想要这个我想它会帮助你解决你的问题 注意:-用户名和密码是“praveen”。我已将示例项目附加到此链接。 http://www.filedropper.com/tabbarapplicationwithlogin

关于ios - 当我按下后退按钮时出现 Uinavigation 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38158494/

相关文章:

iphone - 如何从 UIViewController 访问 UINavigationController

ios - 动画容器 View Controller

ios - 如何使用 Google Drive API v3 获取我的云端硬盘中的文件?

iphone - 如何与 HTTP_PROXY 服务器建立 NSStream 套接字连接(服务器也需要身份验证)?

iphone - iOS向前兼容或向后兼容

ios - 用图像填充 UICollectionView 返回 nil : Swift 2

objective-c - 何时在 swift 中使用respondsToSelector?

objective-c - 使用 Apple Search API 按流派搜索?

iphone - 刷新 View Controller

iphone - iOS 5 有垃圾收集功能吗?