gpt4 book ai didi

ios - 如何在弹出到 rootView Swift 后立即更改选项卡?

转载 作者:行者123 更新时间:2023-11-28 10:40:14 26 4
gpt4 key购买 nike

我有一个包含 5 个选项卡的选项卡 View ,每个选项卡都嵌入在导航 Controller 中!在选项卡 1 中,我输入 View Controller A,然后输入到 View Controller B!在 B View Controller 中的按钮上,我想弹出到 Root View ,并更改选项卡!我使用了这段代码:

  self.navigationController?.popToRootViewController(animated: true)                  
self.tabBarController?.selectedIndex = 4

但它只会弹出到 Root View ,并且不会更改选项卡!我怎样才能做到这两个?!

最佳答案

你必须改用它。

 self.navigationController?.tabBarController?.selectedIndex

关于ios - 如何在弹出到 rootView Swift 后立即更改选项卡?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50832884/

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