什么是在一个应用程序中组合导航栏和标签栏的正确故事板示例? [英] what would be a proper storyboard example of combining nav bars and tab bars in one app?

查看:311
本文介绍了什么是在一个应用程序中组合导航栏和标签栏的正确故事板示例?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是ios app dev的新手。到目前为止,我只完成了使用导航栏或标签栏覆盖应用程序的教程。现在我想制作一个结合两者的应用程序。

Hi I'm new to ios app dev. I've only done tutorials so far that have covered apps with either nav bars or tab bars. Now I want to make an app combining both.

所以,我说我的应用程序底部有一个标签栏,有两个标签:朋友和敌人。在每个标签中,我计划有一个运行列表,列出我的朋友和敌人是谁,因此需要在每个标签的导航栏上添加一个addPerson按钮。

So, say I have an app with a tab bar at the bottom with two tabs: friends and enemies. In each tab i plan to have a running list of who my friends and enemies are, so it will need an addPerson button on the nav bar of each tab.

考虑到这种情况,组织我的控制器和视图和东西的正确方法是什么?
我的标签控制器和我的导航控制器都指向同一个视图控制器吗?

given that scenario, what would be the proper way to organize my controllers and views and stuff? would both my tab controller and my nav controller be pointing to the same view controller?

我无法理解我的导航控制器(2个导航控制器)现在?)可以在更复杂的应用程序中工作。

i'm having trouble conceptualizing how my nav controller(2 nav controllers now?) would work in a more complex app.

推荐答案

以下是如何在故事板中进行设置。 TabBarController 是主控制器。 TabBarController 的每一项都有自己的 NavigationController

Here is how to set it up in your Storyboard. The TabBarController is the main controller. Each item of the TabBarController has its own NavigationController:

您可能想要为您的列表使用 TableViewController 。这里我展示了 TableViewController 作为 NavigationController 的rootViewController。

You probably want to use a TableViewController for your lists. Here I have shown the TableViewController as the rootViewController of the NavigationController.

快速构建它的方法是删除Storyboard中的所有内容,然后拖出两个 TableViewControllers 将一个直接放在另一个上面。通过拖动它们周围的轮廓来选择它们,然后从菜单中选择编辑器 - >嵌入 - >标签栏控制器。然后依次选择每个 TableViewController 并选择编辑器 - >嵌入 - >导航控制器

A quick way to construct this is to delete everything in the Storyboard and then drag out two TableViewControllers placing one directly above the other. Select both by dragging an outline around them both, and then select Editor->Embed In->Tab Bar Controller from the menu. Then select each TableViewController in turn and select Editor->Embed In->Navigation Controller.

这篇关于什么是在一个应用程序中组合导航栏和标签栏的正确故事板示例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆