简体   繁体   中英

UITabBarController is possible to select the tab via code?

难道UITabBarController可以在代码中选择选项卡吗?比如UINavigationController我们可以使用popViewController弹出回rootViewController而不是按下后退按钮,那么如何在tabbarcontroller中实现呢?

Use the selectedIndex property on the UITabBarController. More information can be found in the UITabBarController Class Reference .

controller.selectedIndex = 4;

or use

[controller setSelectedIndex:4];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM