我目前正在开发一个iOS应用程序,这将有5个选项卡栏图标。只有在允许您查看的情况下,其中一个才应可见。如何隐藏此图标?
发布于 2019-05-30 17:53:52
如果要从tabBar中删除UIViewController,请在UITabBarControllerClass中添加以下代码行
用于删除
self.viewControllers?.remove(at: tabIndex) // replace the tabIndex which you want to remove对于Add
self.viewControllers?.insert(viewController, at: tabIndex) // replace the viewcontroller with your controller and tabIndex with your index发布于 2019-05-30 17:48:26
使用下面的代码,您可以从选项卡栏中移除指定的选项卡:
let tabIndex = 3
if let tabBarController = self.tabBarController {
if tabIndex < tabBarController.viewControllers?.count {
var allViewControllers = tabBarController.viewControllers
allViewControllers?.remove(at: tabIndex)
tabBarController.viewControllers = allViewControllers
}
}https://stackoverflow.com/questions/56375363
复制相似问题