gpt4 book ai didi

ios - 如何更改 iOS Swift 中的默认选项卡栏项目?

转载 作者:行者123 更新时间:2023-11-29 01:41:36 25 4
gpt4 key购买 nike

override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
println("TabBar viewDidAppear")
self.checkForNewKey()
if freshLaunch == true {
freshLaunch = false
self.tabBar.selectedItem = tabBar.items![2] as? UITabBarItem
}
}

我这样做了...但是整个应用程序崩溃了(不知道为什么)。我的标签栏中有 5 个项目。

最佳答案

使用self.tabBarController.selectedIndex = 2

而不是self.tabBar

关于ios - 如何更改 iOS Swift 中的默认选项卡栏项目?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32328611/

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