我们可以使用什么策略和 API 在保留 View 层次结构的同时推送到下一个 View Controller ?
例如,当 rootViewController 的状态是我想显示集合列表的一种方式时。当 rootViewController 的状态是另一种方式时,我想显示其中一个集合的详细信息并保留导航层次结构,以便我们可以将一个级别弹回集合并再次弹到 rootViewController。
一个可能的解决方案是检查 middleVC 中 rootViewController 的状态,并让 middleViewController 决定是否推送第三个 ViewController。我不喜欢这个想法,因为属于 rootViewController 的逻辑现在位于 middleVC 中,这似乎破坏了封装。是吗?
感谢您的建议。
最佳答案
我可以建议你像往常一样插入你的第三个 View Controller , 将你的[navigationController viewControllers]放入NSArray中,然后在索引1处插入你的第二个viewController
所以你位于 rootViewController Controller1 索引 0
您推送所需的 viewController Controller3 索引 1
然后您在索引 1 处插入 Controller2,这样您的 Controller3 就会变成索引 2。
关于ios - 如何在 Storyboard中连接下一个 View Controller 后推送 View Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39023144/