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

有帮助吗?

解决方案

在UITabBarController上使用selectedIndex属性。更多信息可以在 UITabBarController类参考

controller.selectedIndex = 4;

或使用

[controller setSelectedIndex:4];

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top