Reputation: 315
As the title states, how do you hide/show a tab in a tab bar where a tab bar controller is programmatically?
Or is there a better way to do this, since I want to show a certain tab containing a certain view depending on the user that logs in.
Upvotes: 4
Views: 2221
Reputation: 3174
Assuming that you have a subclass of UITabBarController:
final class YourSubClass: UITabBarController {
override func viewDidLoad() {
super.viewDidLoad()
viewControllers?.remove(at: 0) // remove the first tab, tab index starts with 0
}
}
Upvotes: 4
Reputation: 139
Use the following code to hide/show tab bar in ios
var tab = UITabBarController()
override func viewDidLoad()
{
super.viewDidLoad()
tab.tabBar.hidden = true //set false to show
}
Upvotes: -1