ios - tabBarController.selectedViewController 的默认值?

标签 ios uinavigationcontroller uitabbarcontroller default-value

在我的 iOS 应用程序中,我有一个带有几个导航 Controller 的 tabBarController。在 applicationDidFinishLaunching tabBarController.selectedViewController 中为 null。这是在我将 navigationControllers 分配给 tabBar 的 tabBarItems 之后。

tabBarController.selectedViewController 的默认值是多少?

或许可以设置为第一个navigationController。可能需要小心从后台启动的应用程序(在这种情况下,用户可能没有在第一个 navigationController 处停止)。

最佳答案

来自 UITabBarController 的文档,在 selectedViewController 下:

This view controller is the one whose custom view is currently displayed by the tab bar interface. The specified view controller must be in the viewControllers array. Assigning a new view controller to this property changes the currently displayed view and also selects an appropriate tab in the tab bar. Changing the view controller also updates the selectedIndex property accordingly. The default value of this property is nil.

关于ios - tabBarController.selectedViewController 的默认值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8363853/

相关文章:

ios - NSAutoLayout, View , 表格 View

ios - UINavigtionController Nib 的顶部栏黑色不透明不在 UIViewController 上显示黑色

ios - '试图弹出一个不存在的 View Controller

iOS:无法设置导航栏色调颜色

iphone - 每次单击选项卡栏项目时如何刷新 View ?

swift - 使用标签栏和导航栏设置初始 View Controller

javascript - Backbone Jquery Click 在 iOS 上出现巨大延迟

ios - 如何在 if else 条件下将 bool 值返回给 swift 2.0 中的函数?

ios - 如何获取 UIMoreListController(私有(private)框架类)的 subview Controller ?

ios - 在我的个人设备上测试我的 iPhone 应用程序时出现问题