connorvo
connorvo

Reputation: 821

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)
}

Upvotes: 0

Views: 844

Answers (1)

Saranjith
Saranjith

Reputation: 11567

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.

enter image description here

Upvotes: 1

Related Questions