正如标题所述,如何隐藏/显示选项卡栏中标签栏控制器以编程方式显示的选项卡?
或者有更好的方法来执行此操作,因为我想根据登录的用户显示包含特定视图的特定选项卡。
答案 0 :(得分:2)
假设你有一个UITabBarController的子类:
class YourSubClass: UITabBarController {
override func viewDidLoad() {
super.viewDidLoad()
viewControllers?.remove(at: 0) // tab index starts with 0, this will remove the first tab
}
}
答案 1 :(得分:-1)
使用以下代码隐藏/显示ios中的标签栏
var tab = UITabBarController()
override func viewDidLoad()
{
super.viewDidLoad()
tab.tabBar.hidden = true //set false to show
}