问题描述
我有一个选项卡栏设置,我希望能够让用户更改选项,并且在选择了最后一个选项或通过按视图上的按钮后,能够自动切换到另一个选项卡.
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.
简单来说,我有4个选项卡设置,在一个选项卡上,我选择一个选项或按一个按钮,然后希望它切换到另一个选项卡.我在主窗口上有一个标签栏,并有4个单独的视图,每个视图都是一个nib文件.
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.
推荐答案
确定要在此处使用TabBarController而不是NavigationController吗?对于TabBar,您要查找的答案是设置-selectedViewController
或-selectedIndex
.对于您列出的特定情况,-selectedIndex
可能是最好的选择.
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.
这篇关于如何在不触摸标签的情况下切换到UITabBar的另一个标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!