简体   繁体   中英

Change View Controller in Tab Bar Controller (Swift)

A little background: My app pops a View Controller that has questions. 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).

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.

I want the tab bar to remain at the bottom of the screen but I want the View Controller to change upon swiping

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

In Tabbar Controller put a navigation controller. Above the same you can push as much as view controllers of same type or that of different types. It will work.

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM