Remove tab bar item text, show only image

前端 未结 19 2089
我寻月下人不归
我寻月下人不归 2020-12-04 06:50

Simple question, how can I remove the tab bar item text and show only the image?

I want the bar items to like in the instagram app:

相关标签:
19条回答
  • Easiest way and always works:

    class TabBar: UITabBar {
    
        override func layoutSubviews() {
            super.layoutSubviews()
    
            subviews.forEach { subview in
                if subview is UIControl {
                    subview.subviews.forEach {
                        if $0 is UILabel {
                            $0.isHidden = true
                            subview.frame.origin.y = $0.frame.height / 2.0
                        }
                    }
                }
            }
        }
    }
    
    0 讨论(0)
提交回复
热议问题