且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在选项卡视图控制器故事板应用程序中添加更多选项卡?

更新时间:2022-06-23 08:13:12

添加一个视图控制器 (UIViewController) 并与您的 tabBarController 以关系视图控制器"添加它(要做到这一点,请右键单击标签栏控制器并拖动它到新的视图控制器并选择最底部的关系海格,即视图控制器),您的 XIB 页面应如下所示:

Add one view controller (UIViewController) And Add it with your tabBarController in relationship "View Controllers"(To do this right click on tab bar controller and drag it to new view controller and select bottom most relationship seague, i.e. view controller), your XIB page should look like:

您可以对其余部分应用相同的模式.

You can apply same pattern for the rest.

正如@Jamie 所说:您必须转到菜单并单击新建文件",然后单击 Objective-C 类,最后确保选择 UIViewController 子类.命名它,然后它将添加文件.现在在您的故事板中,确保将每个选项卡的类更改为您的文件名.即为您的 ViewController 分配自定义类,我在 Image 中使用了 Name AAA.

As @Jamie Said: You have to go to the menu and click on "New File", then Objective-C class, and finally make sure to select UIViewController subclass. Name it and then it will add the files. Now in your storyboard make sure to change the class of each tab to the name of your file. i.e. to assign custom class for your ViewController this I have used Name AAA for that in Image.