ios - self.navigationController.tabBarController.selectedIndex 不工作

标签 ios uiviewcontroller uinavigationcontroller uitabbarcontroller

我有一个 UITabBarController,它包含 4 个不同的 UIViewControllers

在第一个选项卡上有一个UINavigationViewController,它包含它的子UIViewController。在不点击标签栏的情况下,我想将用户带到第二个标签上。为此,我尝试了:

self.navigationController.tabBarController.selectedIndex = 1;

但它不起作用。

忽略任何错误,我是新手。

谢谢。

最佳答案

如果设置委托(delegate) 试试这个:

self.selectedIndex = 1;

你是 tabBarController :)

关于ios - self.navigationController.tabBarController.selectedIndex 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10523538/

相关文章:

iphone - 将 UIViewController 转换为 UIScrollViewController

ios - subview Controller 必须有一个共同的父 View Controller ?

ios - 应用程序崩溃 (SIGABRT) 仅在 AppStore 审核中出现,不在 Sim 或我的硬件中出现

c# - Xamarin : comparison to native SDK and JS-based frameworks

ios - 通过 iOS 应用程序以编程方式从 iPhone 读取 UDID

ios - 如何在 objective-c 中的sqlite数据库中存储和检索NSArray对象

ios - 由于自动布局和大量 subview ,关闭 VC 非常慢

iphone - 从右到左 UINavigationController

ios - 带有缩放动画的 pushviewcontroller,如 ios 照片应用程序

ios - UITabBarController 隐藏更多导航条