【发布时间】:2014-04-29 01:23:22
【问题描述】:
我目前正在尝试将 UITabBar 用于包含 7 个 tabBar 项的 iOS 应用程序。
当我使用情节提要时,我能够实现所有 7 个tabBarItems。
当我以编程方式添加 tabBarItems 时,它会强制“更多”按钮访问其他 tabBarItems。
当我手动创建UITabBar 时,有没有办法以编程方式保留所有 7 个 tabBarItems?
我用来在我的 appdelegate.m 中构建 uitabbar 的代码
self.tabBarController = [[UITabBarController alloc] init];
FirstViewController *firstVC = [[FirstViewController alloc] init];
SecondViewController *secondVC = [[SecondViewController alloc] init];
ThirdViewController *thirdVC = [[ThirdViewController alloc] init];
FourthViewController *fourthVC = [[FourthViewController alloc] init];
FifthViewController *fifthVC = [[FifthViewController alloc] init];
SixthViewController *sixthVC = [[SixthViewController alloc] init];
SeventhViewController *seventhVC = [[SeventhViewController alloc] init];
NSArray *controllers = @[firstVC, secondVC, thirdVC, fourthVC, fifthVC, sixthVC, seventhVC];
self.tabBarController.viewControllers = controllers;
self.window.rootViewController = self.tabBarController;
[_window addSubview:_tabBarController.view];
【问题讨论】:
-
你能添加你的代码吗?
标签: ios iphone uitabbarcontroller