gpt4 book ai didi

swift - 在 Xcode Swift 中的不同导航 Controller 之间移动

转载 作者:行者123 更新时间:2023-11-30 12:01:21 29 4
gpt4 key购买 nike

我想从一个 UINavigatioController 移动到另一个 UINavigatioController。场景是:首先,我在 ContactVC,按任意单元格后,我将转到 ChatVC。现在,当我按下 chatVC 上的后退按钮时,我想返回 InboxVC。我怎样才能实现这个场景。

select contact in contact list and move to chat VC and in chatVC, on pressing back button which shows in navigation bar I move to inbox VC

最佳答案

UINavigationController 是一个基于堆栈的导航系统。这意味着当您向前导航时,您只需将另一个 UIViewController 添加到堆栈中,而当您向后导航时,您会从堆栈中弹出一个 UIViewContrller

要执行您所建议的操作,您需要更改当前位于导航堆栈中的底层 UIViewController。您可以通过在 UINavigationController 上以编程方式使用 func setViewControllers(_ viewControllers: [UIViewController],animated: Bool) 来完成此操作,但您不能通过 Storyboard 来完成此操作,因为那样不是 UINavigationController 的用途。

关于swift - 在 Xcode Swift 中的不同导航 Controller 之间移动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47183964/

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