选项卡栏在 segue 上消失
Tab Bar disappears on segue
我想达到的目标:
- 我有一个
"Login" ViewController
可以转到 Tab Bar Controller
。
- 我的
Tab Bar Controller
进入 Navigation Controller
,然后 "Home" ViewController
进入 Table View
。此视图是我的 "Home/Welcome" 页面。我希望在底部有一个标签栏以及一个静态 table,我可以用 Prototype Cells 对其进行编辑。每个单元格转到不同的 ViewController
.
- 然后,我希望能够点击每个单元格(我现在有 "Info" 设置)并转到相应的
ViewController
。现在,"Info" 单元格应该转到第二个 Navigation Controller
,然后是 "Information" ViewController
。
- 从那里,我想要另一个静态 table,我可以用 Prototype Cells 编辑它。每个单元格将进入单独的 ViewController 堆栈。
我的问题:
当我从 "Home" ViewController
中的 "Info" 单元格开始时,信息标签栏 "pushes" 向上,标签栏消失。我已经尝试过其他 segue 形式,但 none 其中有 Tab Bar。
我想要它,这样您就可以使用选项卡栏导航到信息 ViewController 或 Home/Welcome ViewController 上的单元格导航到信息页面。
此时我根本没有代码,我只是在使用这些 segues。
有谁知道我如何实现我想要实现的目标,如果是这样,请提供尽可能多的示例代码,因为我对 Swift.
非常陌生
感谢任何帮助!谢谢:)
不要添加 segue
以打开属于 UITabBarController
的 "Information" ViewController
。
您必须使用 didSelectRowAt
在 tableview
中选择单元格。只需在其中添加一行即可:
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true) {
self.tabBarController?.selectedIndex = 1
}
这将更改选项卡并打开 "Information" ViewController
。
如果你想用与单元格选择相关的数据加载"Information" ViewController
,你可以使用Protocols
或NotificationCentre
,它们可以将数据从[=传递到"Information" ViewController
21=] 关于单元格选择。
我想达到的目标:
- 我有一个
"Login" ViewController
可以转到Tab Bar Controller
。 - 我的
Tab Bar Controller
进入Navigation Controller
,然后"Home" ViewController
进入Table View
。此视图是我的 "Home/Welcome" 页面。我希望在底部有一个标签栏以及一个静态 table,我可以用 Prototype Cells 对其进行编辑。每个单元格转到不同的ViewController
. - 然后,我希望能够点击每个单元格(我现在有 "Info" 设置)并转到相应的
ViewController
。现在,"Info" 单元格应该转到第二个Navigation Controller
,然后是"Information" ViewController
。 - 从那里,我想要另一个静态 table,我可以用 Prototype Cells 编辑它。每个单元格将进入单独的 ViewController 堆栈。
我的问题:
当我从 "Home" ViewController
中的 "Info" 单元格开始时,信息标签栏 "pushes" 向上,标签栏消失。我已经尝试过其他 segue 形式,但 none 其中有 Tab Bar。
我想要它,这样您就可以使用选项卡栏导航到信息 ViewController 或 Home/Welcome ViewController 上的单元格导航到信息页面。
此时我根本没有代码,我只是在使用这些 segues。 有谁知道我如何实现我想要实现的目标,如果是这样,请提供尽可能多的示例代码,因为我对 Swift.
非常陌生感谢任何帮助!谢谢:)
不要添加 segue
以打开属于 UITabBarController
的 "Information" ViewController
。
您必须使用 didSelectRowAt
在 tableview
中选择单元格。只需在其中添加一行即可:
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true) {
self.tabBarController?.selectedIndex = 1
}
这将更改选项卡并打开 "Information" ViewController
。
如果你想用与单元格选择相关的数据加载"Information" ViewController
,你可以使用Protocols
或NotificationCentre
,它们可以将数据从[=传递到"Information" ViewController
21=] 关于单元格选择。