UISegmentedcontrol to switch views in UITabbarcontroller

落爺英雄遲暮 提交于 2019-12-08 02:54:14

问题


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

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?


回答1:


First, consider whether you really want to do this. UITabBarController already gives you the ability to switch views, using the tab bar.

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.



来源:https://stackoverflow.com/questions/5280653/uisegmentedcontrol-to-switch-views-in-uitabbarcontroller

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!