iphone - 如何将 UISegmentedControl 合并到 UITabBarController 中?

标签 iphone objective-c ios uitabbarcontroller uisegmentedcontrol

我使用了以下教程 Red Artisan创建一个 UISegmentedControl,我用它在两个 View 之间切换:一个简单的 View 和一个 TableView 。

当我创建一个新的独立项目时,一切都很好,但我真正想要的是将此功能合并到另一个项目中,并将 UITabBarController 作为根 Controller (具有两个 View 的分段控件将在第二个选项卡内)。

在上面的教程中,分段控件、导航和分段 Controller 是从应用程序委托(delegate)中实例化和配置的。

知道如何从较低级别完成此操作吗?

提前致谢!

最佳答案

基本上,您需要创建一个基于 UITTabBarController 的应用程序(有很多关于如何执行此操作的教程),然后在第二个 UIViewController(或自定义子类),您将创建您的 UISegmentedControl 以在两个页面之间切换。

听起来您可能还在第一个应用程序中使用 UINavigationController 作为基本 Controller ,如果是这样的话......您可以有一个 UITabBarController,它有两个其中的 Controller (两个选项卡),第二个将是 UINavigationController,就像您在应用程序委托(delegate)中设置它一样。

此外,互联网上还有基本上可以完成这件事的教程。尝试在 UITabBarController 内搜索“UINavigationController ”或类似内容。另一件事,Apple UI 文档中有一个“分层”如何使 UINavigationController 成为 UITabBarController 的选项卡之一的示例(这是 iPhone 应用程序的一种非常常见的方法)

祝你好运!

关于iphone - 如何将 UISegmentedControl 合并到 UITabBarController 中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5119148/

相关文章:

ios - SQLite id 字段 - 自动填充

ios - 有没有办法检测 USB 以太网适配器是否以编程方式连接到 iPhone/iPad?

ios - 应用程序无法从 iCloud Drive 中的文档启动

html - iPhone 3GS 上的标题显示不正确

iPhone SDK修剪音频文件

objective-c - 如何使用 Storyboard动态原型(prototype) TableView Cell 来格式化 UISearchDisplayController 结果

objective-c - 如何在 iOS 的 Objective-C 中创建和保存 .rtf、.doc、.docx

iphone - CAShaperLayer -renderInContext 不起作用?

iphone - 如何在 iOS7 中以编程方式获取设备 UDID?

iphone - UIPickerView 选择行 :inComponent:animated With smooth animation