选项卡栏在 segue 上消失

Tab Bar disappears on segue

我想达到的目标:

我的问题: 当我从 "Home" ViewController 中的 "Info" 单元格开始时,信息标签栏 "pushes" 向上,标签栏消失。我已经尝试过其他 segue 形式,但 none 其中有 Tab Bar。 我想要它,这样您就可以使用选项卡栏导航到信息 ViewController 或 Home/Welcome ViewController 上的单元格导航到信息页面。

此时我根本没有代码,我只是在使用这些 segues。 有谁知道我如何实现我想要实现的目标,如果是这样,请提供尽可能多的示例代码,因为我对 Swift.

非常陌生

感谢任何帮助!谢谢:)

不要添加 segue 以打开属于 UITabBarController"Information" ViewController

您必须使用 didSelectRowAttableview 中选择单元格。只需在其中添加一行即可:

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
    tableView.deselectRow(at: indexPath, animated: true) {
    self.tabBarController?.selectedIndex = 1
}

这将更改选项卡并打开 "Information" ViewController

如果你想用与单元格选择相关的数据加载"Information" ViewController,你可以使用ProtocolsNotificationCentre,它们可以将数据从[=传递到"Information" ViewController 21=] 关于单元格选择。