iphone - UITabBarController 可以通过代码选择选项卡吗?

标签 iphone uitabbarcontroller

UITabBarController是否可以在代码中选择选项卡?就像UINavigationController一样 我们可以使用popViewController弹回rootViewController来代替按后退按钮,那么在tabbarcontroller中如何实现呢?

最佳答案

使用 UITabBarController 上的 selectedIndex 属性。更多信息可参见UITabBarController Class Reference .

controller.selectedIndex = 4;

或使用

[ Controller setSelectedIndex:4];

关于iphone - UITabBarController 可以通过代码选择选项卡吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/833389/

相关文章:

ios - 在 UINavigationController 中支持纵向和横向 View 的最佳实践

iphone - UITabBarViewController 崩溃

iphone - 比较相同日期/时间的两个 NSDates

ios - 如何在屏幕之间执行清晰的导航?

iphone - 在 0 到 2.0 的范围内将 UISlider 增加 0.2

iphone - Xcode 4 中没有 mainwindow.xib 困惑如何让我的 TabBarController 使用 NavigationController

iphone - 是否可以将动画插入到切换 View 时显示的 UITabBarController 中?

ios - 以模态方式呈现 ViewController 时如何禁用所有 UITabBarItems?

iphone - iPhone 中的 UIGlassButton

iphone - 声音播放完毕后执行代码的最佳方式