第一个 vc( View Controller )有一个按钮,当我按下它时,我必须转到第二个 vc,它嵌入了标签栏 Controller 。请检查附加图像。
在按钮点击事件中,我这样调用标签栏:-
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/