ios - 在 iOS (Swift) 的标签栏中隐藏标签

标签 ios swift

如标题所述,如何在标签栏 Controller 以编程方式隐藏/显示标签栏中的标签?

或者是否有更好的方法来执行此操作,因为我想根据登录的用户显示包含特定 View 的特定选项卡。

最佳答案

假设你有一个 UITabBarController 的子类:

final class YourSubClass: UITabBarController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        viewControllers?.remove(at: 0) // remove the first tab, tab index starts with 0
    }

}

关于ios - 在 iOS (Swift) 的标签栏中隐藏标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38242902/

相关文章:

ios - 代码 7 : xcdatamodeld doesn’t exist

ios - 当轴垂直时在 UIStackView 的 subview 上设置恒定宽度

swift - 快速修改发送者的属性

ios - 使用 AVAudioEngine 循环音频

Swift 程序约束 view.bottomAnchor 导致问题

ios - @IBDesignable 错误 : IB Designables: Failed to update auto layout status: Interface Builder Cocoa Touch Tool crashed

android - 应用内购买中未列出的Youtube视频

ios - touchesBegin() 创建的 UIView 不会被删除,因为当用户从 iPad 上移开手指时,touchesEnded() 永远不会被调用

swift - SKLabelNode 非常模糊 [包括屏幕截图]

ios - 检查Admob插屏是否完成