Let's say I have a UIButton
in one tab view in my iPhone app, and I want to have it open a different tab in the tab bar of the TabBarController
. How would I write the code to do this?
I'm assuming I unload the existing view and load a specific tab view, but I'm not sure how to write the code exactly.
Try this code in Swift or Objective-C
Swift
self.tabBarController.selectedIndex = 1
Objective-C
[self.tabBarController setSelectedIndex:1];