如何在 UITabBarController 中插入 UINavigationController
如何在 UITabBarController
中插入 UINavigationController
。
目前,我在应用程序委托内有主 UITabBarController
和声明(因此选项卡是主要的),
self.window.rootViewController = self.tabBarController;
并且在其中一个选项卡内我想插入 UINavigationController
,但无法获取它。
代码的构造如下:
MainWindow.xib
,其中包含UITabBarController
对象,其中选项卡类型为UINavigationController
(指向 < code>NavigationHistory.xib) - 屏幕截图:无效链接NavigationHistory.xib
仅包含UINavigationController
,其中指向 History.xibHistory.xib
的视图仅具有UITableView
元素 - 屏幕截图:无效链接
现在 UIViewController
不显示我的 View1 视图,我不知道为什么会这样。也许你有任何线索?或者指出完成此类配置的位置。
How to insert UINavigationController
inside UITabBarController
.
Currently I have main UITabBarController
with declatarion inside application delegate like this (so tab is main)
self.window.rootViewController = self.tabBarController;
And inside one of tabs I want to insert UINavigationController
, and can't get it.
The code is contructed like this:
MainWindow.xib
withUITabBarController
object with tab typed asUINavigationController
(point toNavigationHistory.xib
) - screenshot: invalid linkNavigationHistory.xib
contains onlyUINavigationController
where view point to History.xibHistory.xib
have onlyUITableView
element - screenshot: invalid link
And now UIViewController
doesn't display my View1 view, and I have no clue why it may be. Maybe you have any clue? or point me to the place where such configuration is done.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我自己来回答吧。很好解释在
https://developer.apple.com/库/ios/#documentation/WindowsViews/Conceptual/ViewControllerCatalog/Chapters/CombiningViewControllers.html
I'll answer myself. It's good explained at
https://developer.apple.com/library/ios/#documentation/WindowsViews/Conceptual/ViewControllerCatalog/Chapters/CombiningViewControllers.html
在appdelegate.m文件中编写代码......
Write a code in appdelegate.m file.....
将控制器对象添加到 UINavigationController,并将该 navigationcontroller 对象添加到 UITabBarController
Add your controller object to UINavigationController, and add that navigationcontroller object to UITabBarController
UINavigationController 是 UIViewController 的子类, UITabBarController 需要 UIViewController 数组(因此 UINavigationController );这告诉我,我可以为 UITabBarController 提供一个 UINavigationControllers(或其子类)数组,以提供所需的交互。
参考: https://developer.apple.com/library/ios/文档/UIKit/Reference/UINavigationController_Class/
https:// developer.apple.com/library/ios/documentation/UIKit/Reference/UITabBarController_Class/
UINavigationController is a subclass of UIViewController, a UITabBarController expects an array of UIViewControllers (and therefore UINavigationController ); this tells me me that I can give a UITabBarController an array of UINavigationControllers (or sublasses thereof) giving the desired interaction.
Ref : https://developer.apple.com/library/ios/documentation/UIKit/Reference/UINavigationController_Class/
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITabBarController_Class/
}
}