ios Xcode:如何在 IOS5 故事板中添加新标签屏幕?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10334215/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Xcode: How to add new tab screen in IOS5 storyboard?
提问by 001
I have this.. How do I add another tab screen using iOS5 storyboard, so that "Account" can have 3 screens.
我有这个.. 如何使用 iOS5 故事板添加另一个标签屏幕,以便“帐户”可以有 3 个屏幕。
Account ---> Account Listing ---> Account Details
账户 ---> 账户列表 ---> 账户详情
回答by Thilo
You first drop in a new ViewController, and then you Ctrl-drag from the Tab Bar Controller to that new controller.
首先放入一个新的 ViewController,然后按住 Ctrl 键从 Tab Bar Controller 拖动到该新控制器。
This brings up a popup where you can select "Add Relationship Segue". This connects it as a third tab.
这会弹出一个弹出窗口,您可以在其中选择“添加关系 Segue”。这将它连接为第三个选项卡。
回答by Tim
This can be done programmatically:
这是可以做到编程:
// 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;
Or using InterfaceBuilder:
或者使用InterfaceBuilder:
Adding 'Tab Bar Items' to the hierarchy of views in the left-hand panel
将“标签栏项目”添加到左侧面板中的视图层次结构
Or using Storyboard:
或使用故事板:
iOS Storyboards(Scroll down/Search for 'Just Add It To My Tab')
iOS 故事板(向下滚动/搜索“只需将其添加到我的标签”)