两个故事板,都包含 TabBarControllers。如何在他们之间进行segue?

Two storyboards, both contain TabBarControllers. How to segue between them?

我有两个故事板,都包含一个 TabBarController。我们称第一个 storyboard/TabBarController Groups 和第二个 Users

当我从 Groups 转到 Users 时,Users UI会出现,但 Groups 标签栏仍然存在。

如何从 Groups 转到 Users 以便 UI 标签栏更改。

编辑:

我的目标

不要为此使用 segue。不可能让 UIKit 知道你真正想做的是切换选项卡,它只是认为你想从故事板创建一个 viewController 实例并将其推入导航堆栈。

试试这个:

self.tabBarController?.selectedIndex = // the index of your dest tab, start from 0

您的问题违反了 Apple 关于 Tab Bar 的指南。也就是说,如果您真的愿意,我相信您可以做到,但我建议您重新考虑您的设计,因为:

  1. 设计观点:Apple 的 HIG 为智能 phone 环境设计的非常合理,因此遵循它比完全忽略它更有帮助。
  2. 实用角度:你的应用在App Store被拒绝的几率会更高。

来自 Apple 的 iOS 人机界面指南:

Use a tab bar to give users access to different perspectives on the same set of data or different subtasks related to the overall function of your app.

In general, use a tab bar to organize information at the app level. A tab bar is well suited for use in the main app view because it’s a good way to flatten your information hierarchy and provide access to several peer information categories or modes at one time.

Don’t use a tab bar to give users controls that act on elements in the current screen or app mode. If you need to provide controls, including a control that displays a modal view, use a toolbar instead (for usage guidelines, see Toolbar).

Link

您要执行的操作完全合法且简单。简单地从一个 UITabBarController 到另一个进行呈现/模式转换。这将用新界面(第二个标签栏控制器和 its 标签栏)完全替换界面(第一个标签栏控制器及其标签栏)。