如何将 UISegmentedControl 合并到 UITabBarController 中?
我使用以下教程 Red Artisan 创建 UISegmentedControl我用它在两个视图之间切换:一个简单的视图和一个表视图。
当我创建一个新的独立项目时,一切都很好,但我真正想要的是将此功能合并到另一个项目中,并以 UITabBarController 作为根控制器(具有两个视图的分段控件将位于第二个选项卡内)。
在上面的教程中,分段控件、导航和分段控制器是在应用程序委托中实例化和配置的。
知道如何从较低级别完成此操作吗?
先感谢您!
I used the following tutorial Red Artisan to create a UISegmentedControl which I use to switch between two views: a simple one and a table view.
Everything is fine when I create a new standalone project, but what I really want is to incorporate this functionality in another project with a UITabBarController as the rootController (the segmented control with two views will be inside the second tab).
In the above tutorial the segmented control, navigation and segment controllers are instantiated and configured from within the application delegate.
Any idea how this could be done from a lower level?
Thank you in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
基本上,您需要创建一个基于 UITTabBarController 的应用程序(有很多关于如何执行此操作的教程),然后在第二个
UIViewController
(或自定义子类)中,您将创建UISegmentedControl
在两个页面之间切换。听起来您可能还使用
UINavigationController
作为第一个应用程序中的基本控制器,如果是这样的话..您可以拥有一个包含两个控制器的UITabBarController
(两个选项卡),第二个将是一个UINavigationController
,就像您在应用程序委托中设置它的方式一样。此外,互联网上也有基本上可以完成此操作的教程。尝试在
UITabBarController
内搜索“UINavigationController
”或类似内容。另一件事,Apple UI 文档中有一个示例,说明“分层”如何工作,使 UINavigationController 成为 UITabBarController 的选项卡之一(这是 iPhone 应用程序的一种非常常见的方法)祝你好运!
Basically, you need to create a
UITTabBarController
based application (There are LOTs of tutorials on how to do this), and then in the secondUIViewController
(or a custom subclass), you would create yourUISegmentedControl
to switch between two pages.It sounds like you might also be using a
UINavigationController
as your base controller in the first application, if this is so..you could have aUITabBarController
that has two Controllers in it (two tabs), and the second one will be aUINavigationController
like how you had it setup in the app delegate.Also, there are tutorials to do basically this exact thing all over the internet. Try searching for "
UINavigationController
insideUITabBarController
" or similar. One other thing, there is an example of how the "layering" works in the Apple UI documentation for having a UINavigationController be one of the tabs of a UITabBarController (This is a quite common approach for iPhone apps)Good luck!