gpt4 book ai didi

ios - UITabBarController 在 Swift 语言中设置默认选项卡

转载 作者:行者123 更新时间:2023-11-28 07:17:42 25 4
gpt4 key购买 nike

我有一个 UITabBarController,它附加了 5 个不同的 View Controller 。每个都有自己特定的选项卡,例如“主页”、“设置”等。如何将某个选项卡设置为启动时的默认选项卡?

最佳答案

是否有特定原因导致您无法将所选的第一个选项卡移动到最左侧的位置?

self.tabBarController.selectedIndex = desiredIndex

或者,如果您的代码位于 UITabBarConroller 子类中,只需:

 selectedIndex = desiredIndex

应该可以。

关于ios - UITabBarController 在 Swift 语言中设置默认选项卡,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24785010/

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