简体   繁体   English

在标签栏控制器中更改视图控制器(快速)

[英]Change View Controller in Tab Bar Controller (Swift)

A little background: My app pops a View Controller that has questions. 一点背景:我的应用程序弹出一个有问题的View Controller。 When the person has answered the question, they swipe and View Controller is presented again, this time with new questions (so it is View Controller with question set 1 -> swipe -> (same) View Controller with question set 2). 当此人回答了问题后,他们将滑动并再次显示View Controller,这次是新问题(因此问题集为1的View Controller->滑动->问题集2的(相同)View Controller)。

This works fine when I do not have View Controller embedded in a Tab Bar Controller. 当我没有在选项卡栏控制器中嵌入视图控制器时,这可以很好地工作。 However, when it is embedded in a Tab Bar Controller and I swipe, the View Controller is presented but the Tab Bar Controller is no longer there. 但是,当将其嵌入到Tab Bar Controller中并且我滑动时,将显示View Controller,但Tab Bar Controller不再存在。

I want the tab bar to remain at the bottom of the screen but I want the View Controller to change upon swiping 我希望标签栏保留在屏幕底部,但我希望View Controller在滑动时进行更改

func swipeGesture() {
    // gesture stuff in here
    self.present(ViewController(), animated: true)
}

In Tabbar Controller put a navigation controller. 在Tabbar Controller中,放置一个导航控制器。 Above the same you can push as much as view controllers of same type or that of different types. 在同一个视图之上,您可以按相同类型或不同类型的视图控制器进行最多的推送。 It will work. 它会工作。

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 实例化View Controller Swift 3 Tab Bar Controller - Instantiate View Controller Swift 3 Tab Bar Controller Swift 2:更改与标签栏控制器相关的视图上的导航标题 - Swift 2 : Change navigation title on a view related to a Tab Bar Controller 如何将视图控制器更改为选项卡栏控制器作为根视图控制器 - How to change view controller to tab bar controller as root view controller 更改选项卡栏中选项卡的目标视图控制器 - Change the destination View Controller of a tab in a Tab Bar Swift 2从视图控制器返回到选项卡栏控制器中的选定选项卡 - Swift 2 Return to a selected tab in tab bar controller from view controller 查看标签栏 controller 从 storyboard swift 5 - view tab bar controller from storyboard swift 5 如何在 Swift 中向 Tab Bar Controller 添加表视图控制器 - How to add a table view Controller to Tab Bar Controller in Swift 迅速,选择从标签栏控制器中拆分视图控制器 - Swift, segue to split View Controller from Tab Bar Controller 如何在标签栏控制器中快速隐藏视图控制器? - how hide a view controller in tab bar controller swift? Swift-从标签栏控制器更新视图控制器内的变量 - Swift - Update variable inside view Controller from Tab Bar Controller
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM