Xcode:如何在iOS5故事板中添加新标签页?
答
这是可以做到编程:
// Tab Controller
UITabBarController *tabBarController = [[UITabBarController alloc]init];
// Views to be accessed
UIViewController *controllerOne = [[UIViewController alloc]init];
UIViewController *controllerTwo = [[UIViewController alloc]init];
UIViewController *controllerThree = [[UIViewController alloc]init];
// Store UIViewControllers in array
NSArray* screenControllers = [NSArray arrayWithObjects:controllerOne, controllerTwo, controllerThree, nil];
// Add Views to Controller
tabBarController.viewControllers = screenControllers;
或者使用的InterfaceBuilder:
-
添加'Tab Bar Items'到左侧面板的视图层次结构
或者使用故事板:
iOS Storyboards(向下滚动/搜索 '只是将它加入到我的标签')
答
您在新的首次下降ViewController,然后按住Ctrl键并从Tab Bar Controller拖动到该新控制器。
这会弹出一个窗口,您可以选择“添加关系Segue”。这将其连接为第三个选项卡。
+0
要添加到上述答案 - 当您将其添加到Storyboard中时,可能需要通过故事板添加图像(甚至作为占位符)。如果您未添加图片,底部栏可能会变成“灰色”,并可能在Storyboard中查看时隐藏其他标签图片... – goggelj 2016-07-11 10:13:52
你可以有一个带3个按钮的工具栏,每个都有独立的视图 – vishy 2012-04-26 13:19:03
使用分页滚动视图怎么样? – Dani 2012-04-26 13:19:38
@Vishy,已经有4个选项卡,但我想要2个额外的查看屏幕帐户选项卡。 – 001 2012-04-26 13:48:47