How to switch to another tab of UITabBar without touching a tab?

大城市里の小女人 提交于 2020-01-03 02:47:15

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!