ios - Swift - 从按钮点击打开特定的标签

标签 ios swift

我实现了一个 UITabBarController 并实现了几个选项卡。现在我在 UITabBarItem 中有一个按钮,我想从那里切换到特定的选项卡。我已经看到使用导航 Controller 的答案,但就我而言,我没有使用导航 Controller 。

NOTE: I have copied this screenshot from the internet so please ignore the navigation bar. I want an answer without using navigation controller.

最佳答案

就用这个。

self.tabBarController.selectedIndex = indexToWhichYouWantToMove;

tabBarController 是您的 TabBarController

的对象

关于ios - Swift - 从按钮点击打开特定的标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46067738/

相关文章:

ios - 当我们退出应用程序而不终止应用程序 Swift 4 时,弹出窗口不会重新出现

ios - 使数组中的无序项目始终保持相同顺序

ios - 如何正确使用 Codable、CoreData 和 NSSet 关系?

swift - 将 UITableView 与 Combine DataSource 绑定(bind)

swift - 如果常量变量是函数类型的类型,那么什么是不能改变的呢?

swift - 在 Swift 中迭代结构体属性

ios - iOS位置问题-看不到任何数据

ios - Bitrise 正在尝试使用错误的配置文件对嵌入式框架进行代码签名

ios - 从另一个类 objc 访问变量

arrays - 使用数组内容时 Swift nil 合并