问题
I have a tab bar setup and I want to be able to let the user change options and after the last one is selected or by pressing a button on the view, be able to automatically switch to another tab.
Simply, I have 4 tabs setup and on one, I pick an option or press a button and I want it to switch to the other tab. I have the tab bar on the main window and 4 separate views, each as a nib file.
回答1:
Are you sure you want a TabBarController here and not a NavigationController? For TabBars, the answer you're looking for is to set -selectedViewController
or -selectedIndex
. For the specific case you list, -selectedIndex
is probably your best bet.
来源:https://stackoverflow.com/questions/948075/how-to-switch-to-another-tab-of-uitabbar-without-touching-a-tab