Aleksandr Maybach
Aleksandr Maybach

Reputation: 610

How can I hide a tabBar when I leave from current UIViewController?

I try do it in willMove method but get bug when I break gesture(swipe to back VC)

override func willMove(toParent parent: UIViewController?) {
super.willMove(toParent: parent)

self.tabBarController?.tabBar.isHidden = true
}

Upvotes: 0

Views: 73

Answers (2)

Ankit Jayaswal
Ankit Jayaswal

Reputation: 5679

In your current view controller:

In viewDidDisappear:

self.tabBarController?.tabBar.isHidden = true

In ViewDidAppear:

self.tabBarController?.tabBar.isHidden = false

Upvotes: 0

Saurabh pandey
Saurabh pandey

Reputation: 250

Use below method in ViewDidLoad() of ViewController(where you are going)

self.tabBarController?.tabBar.isHidden = true

and in ViewDidDisappear()

self.tabBarController?.tabBar.isHidden = false

Upvotes: 2

Related Questions