如何拥有一个为 UINavigationController 调用不同视图的分段控件?
我是一个 iOS/ObjC 新手,我正在尝试找到最好的方法来做到这一点...我想要的是一个分段控件,它具有三个选项:1)地图视图,2)列表视图,以及3)街景。 SC 将位于底部工具栏中。在所有三个视图中,他们都需要能够点击到详细信息视图。
我尝试使用底部工具栏中有分段控件的 UINavigationController,但是当我切换视图时,底部工具栏消失。我还尝试加载仅包含工具栏和空视图的 ViewController,然后将导航控制器加载到该视图中,但它覆盖了工具栏。
任何帮助将不胜感激!
I'm an iOS/ObjC newbie, and I'm trying to find the best way to do this... What I want is to have a segmented control that has three options: 1) Map View, 2) List View, and 3) Street View. The SC will be in the bottom toolbar. In all three views, they'll need to be able to tap over to a Detail View.
I tried using a UINavigationController that has the segmented control in its bottom toolbar, but when I switch views, the bottom toolbar disappears. I've also tried loading a ViewController with just the toolbar and an empty view, then loading the navigation controller into that view, but it overlays the toolbar.
Any help would be appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
对于您描述问题的方式,您可以考虑使用
UITabBarController
而不是UINavigationController
。它应该更适合您的需求。<一href="http://www.google.it/url?sa=t&source=web&cd=1&sqi=2&ved=0CBsQFjAA&url=http://developer.apple.com/library/ios /#文档/UIKit/Ref erence/UITabBarController_Class/Reference/Reference.html&ei=AuspTtKHNcGdOuGHzd0K&usg=AFQjCNE17Vky3OsDv6jcESIVf1Hu6qB8aw&sig2=KuMkY2_X1BF65YesUKZngQ" rel="nofollow">UITabBarController
For the way you described your problem you may consider using a
UITabBarController
instead of aUINavigationController
. It should fit better your needs.UITabBarController
已经很久了,最好的选择是 UITabbarController,如果由于某种原因这是不可能的,还有其他解决方案,包括在所有视图中创建 SC 实例或将视图降级为子视图以放入水平滚动视图中,但只有一个UITabbarCOntroller 将允许他为每个视图使用 3 个不同的导航控制器
Its been ages, The best choice is a UITabbarController, if for some reason this is not possible there are other solutions including creating an instance of a SC in all the views or demoting the views into subviews to be put in a horizontal scrollview but only a UITabbarCOntroller will allow him to use 3 distinct navigationControllers for each of his view