我正在更改我的应用程序以使用 UITabBarController
而不是UINavigationViewController
。我相应地更换了 Controller ,并成功使用选项卡启动了应用程序。后来在代码中,我在使用 segues 时遇到了一些困难,其中像
[self performSegueWithIdentifier:@"ImageViewController" sender:self];
不会产生错误
“只有当源 Controller 由 UINavigationController 实例管理时才能使用推送转场”
当我嵌入UINavigationController
时进入初始FirstViewController
,上面的行工作正常。我需要这条线在 View 之间切换并将一些数据传递到另一个 View Controller 。
问题是使用segue标识符转到SecondViewController
隐藏 TabBar 导航(除非我再次将 SecondViewController
包裹在 UINavigationController
中,依此类推)。那不是解决方案。
问题:如何使用UITabBarController
并仍然利用 Segues,同时保持选项卡导航可见?
最佳答案
"Push segues can only be used when the source controller is managed by an instance of UINavigationController"
在我看来,您正在导航 Controller 之外的某个地方使用push
segue。尝试选择界面生成器中不在导航 Controller 内的所有“segue bubbles”:
并在右侧 Pane 中检查 segue 的样式:
如果样式设置为值push
(如上所示),请将其更改为modal
或custom
:
关于ios - 使用 Segues 将 UINavigationViewController 切换到 UITabBarController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21264762/