UISegmentedcontrol在UITabbarcontroller中切换视图 [英] UISegmentedcontrol to switch views in UITabbarcontroller
问题描述
我正在尝试使用UISegmentedControl
在多个不同的视图之间切换.我找到了一个很好的例子来做到这一点:
http://redartisan.com/2010/6/27/uisegmented -control-view-switching-revisited
I am trying to switch between multiple different views using a UISegmentedControl
. I found a really good example to do this in:
http://redartisan.com/2010/6/27/uisegmented-control-view-switching-revisited
但是,我需要在我的应用中使用UITabbarController
.因此,导航代理在我的应用程序委托中不可用.还有其他方法可以使用UISegmentedControl
在UITabbarController
中切换视图吗?
However, I need to use a UITabbarController
in my app. So the navigation controller is not available for me in the app delegate. Is there any other way to switch views in a UITabbarController
using UISegmentedControl
?
推荐答案
首先,请考虑您是否真的要这样做. UITabBarController已经使您能够使用标签栏切换视图.
First, consider whether you really want to do this. UITabBarController already gives you the ability to switch views, using the tab bar.
如果您确实出于某种原因要执行此操作,则UITabBarController具有属性viewControllers
和selectedViewController
,这些属性应允许您执行类似于该文章中所述的操作.
If you really want to do this for some reason, UITabBarController has properties viewControllers
and selectedViewController
that should allow you to do something like what is described in that article.
这篇关于UISegmentedcontrol在UITabbarcontroller中切换视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!