2012-04-26 78 views
20

enter image description hereXcode:如何在iOS5故事板中添加新标签页?

我有这个.. 如何使用iOS5的故事板,让“客户”可以有3个屏幕增加另一个标签屏幕。

账户--->帐户清单--->账户详情

+0

你可以有一个带3个按钮的工具栏,每个都有独立的视图 – vishy 2012-04-26 13:19:03

+0

使用分页滚动视图怎么样? – Dani 2012-04-26 13:19:38

+0

@Vishy,已经有4个选项卡,但我想要2个额外的查看屏幕帐户选项卡。 – 001 2012-04-26 13:48:47

回答

3

这是可以做到编程

// 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'到左侧面板的视图层次结构

    enter image description here

或者使用故事板

iOS Storyboards(向下滚动/搜索 '只是将它加入到我的标签')

+0

我建议你使用编程方法。还有其他的编程方法可以做到这一点,我肯定会推荐他们使用InterfaceBuilder完成这项任务。做一些你喜欢哪种方法的研究。 – Tim 2012-04-26 13:26:22

+1

你如何在iOS5故事板中做到这一点? – 001 2012-04-26 13:26:57

+0

查看我已编辑的答案,已添加指向其他资源的链接 – Tim 2012-04-26 13:31:02

50

您在新的首次下降ViewController,然后按住Ctrl键并从Tab Bar Controller拖动到该新控制器。

这会弹出一个窗口,您可以选择“添加关系Segue”。这将其连接为第三个选项卡。

+0

要添加到上述答案 - 当您将其添加到Storyboard中时,可能需要通过故事板添加图像(甚至作为占位符)。如果您未添加图片,底部栏可能会变成“灰色”,并可能在Storyboard中查看时隐藏其他标签图片... – goggelj 2016-07-11 10:13:52