ios - 在标签栏 Controller 中访问多个导航 Controller

标签 ios objective-c

我有一个导航栏 Controller ,我将其嵌入到标签栏 Controller 中。然后,我将另外两个导航栏 Controller 放到 Storyboard上,并创建从选项卡栏 Controller 到两个新导航栏 Controller 的推送序列,因此我预计下面的日志语句为 3,用于选项卡栏 Controller 上的 View Controller 数量,但是,它记录了 1。下面的最后一行代码也明显抛出了越界错误,因为没有 objectAtIndex:1 。你可以解释吗?为什么我创建的第二个和第三个导航栏 Controller 没有将情节推送到标签栏 Controller 的 viewControllers 属性中?

UITabBarController *tbc = (UITabBarController *)self.window.rootViewController;
NSLog(@"tbc %lu", (unsigned long)[[tbc viewControllers] count]);
UINavigationController *nav = (UINavigationController *)[[tbc viewControllers] objectAtIndex:0];
UINavigationController *nav2 = (UINavigationController *)[[tbc viewControllers] objectAtIndex:1];

最佳答案

问题是,当我将选项卡栏 Controller 连接到 Storyboard 中的第二个和第三个导航 Controller 时,我创建了一个“推送”转场。但是,它必须是选项卡栏 Controller 和它所连接的任何 View Controller 之间的“关系”。

关于ios - 在标签栏 Controller 中访问多个导航 Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23612006/

相关文章:

ios纵向和横向模式

ios - 在 Objective-C 中声明 ImageView 的另一种方法

ios - 显示 UILabels 和 UIButtons Inline 彼此的方法

ios - WatchKit 调用 webview

objective-c - 有没有办法将 ObjectiveC block 包装到函数指针中?

ios - UIWebView 中的自定义 CSS

c++ - Eigen在ios项目中的使用

javascript - Modernizr.mq 事件多次触发

ios - 用于 'if not' 的 Objective-C 预处理器指令

ios - 如何在 UIDatePicker 选定行中设置绿色?