Change UITabBar selectedItem in Swift
问题 How can I programmatically change the selected item in a UITabBar? 回答1: Swift 3 and later As of Swift 3, you can also use tabBarController.selectedIndex = 0 // (or any other existing index) (Thank you, @nidomiro.) Swift 2.2 and earlier Try the following tabBar.selectedItem = tabBar.items![newIndex] as! UITabBarItem Assuming you have access to the UITabBarController that owns the UITabBar , you can do the following self.selectedViewController = self.viewControllers![newIndex] as!