iphone - 有好的 UITabBarController 示例吗?

标签 iphone objective-c cocoa-touch interface-builder uitabbarcontroller

是否有一个很好的 UITabBarController 示例,它不是是在 appDelegate 中创建的?

我想在 UIViewController 中使用 UITabBarController,但是不知道如何设置 View 导出。

最佳答案

这就是全部 very well documented here . UITabBarController 实例的创建位置无关紧要,无论是否有 UIApplicationDelegate。简而言之,创建您各自的所有 UIViewController 并将它们添加到数组中。然后将该数组分配给您的 UITabBarController 的 viewControllers 属性。然后你可以简单地做一些像[window addSubview:myTabBarController.view]这样的事情。

我只是从此处的文档中复制/粘贴:

You should never access the tab bar view of a tab bar controller directly. To configure the tabs of a tab bar controller, you assign the view controllers that provide the root view for each tab to the viewControllers property. The order in which you specify the view controllers determines the order in which they appear in the tab bar. When setting this property, you should also assign a value to the selectedViewController property to indicate which view controller is selected initially. (You can also select view controllers by array index using the selectedIndex property.) When you embed the tab bar controller’s view (obtained using the inherited view property) in your application window, the tab bar controller automatically selects that view controller and displays its contents, resizing them as needed to fit the tab bar interface.

关于iphone - 有好的 UITabBarController 示例吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3011262/

相关文章:

iphone - 在输出中使用 '%'

iphone - iOS 数据文件允许文件安全、编码吗?

ios - 如何在 iOS 中为类似标签的文本输入创建文本字段?

iphone - 使用 NSUserDefaults 存储 iPhone 应用程序的最新状态是个好主意吗?

iphone - 如何从NSarray中删除括号

iphone - 在 Xcode 6、iOS 8 中使用 Size 类设计 ViewController

ios - 如何在google中获取用户出生日期和性别加上ios中最新的SDK版本2.1.0

objective-c - Obj-C 在同一个类中的静态方法的静态方法上使用@selector?

ios - Objective-C 宏类型

iphone - Verizon iPhone 用户将无法使用 iOS 4.3 或更高版本?