如何在不触摸标签的情况下切换到UITabBar的另一个标签? [英] How to switch to another tab of UITabBar without touching a tab?

查看:52
本文介绍了如何在不触摸标签的情况下切换到UITabBar的另一个标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个选项卡栏设置,我希望能够让用户更改选项,并且在选择了最后一个选项或通过按视图上的按钮后,能够自动切换到另一个选项卡.

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的另一个标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆