changing the height of UITabBar in iOS7/8?

前端 未结 8 2081
轮回少年
轮回少年 2020-12-08 05:29

I am trying to change the height of the stock UITabBar to 44px, similar to Tweetbot\'s tab bar height. I\'ve also seen a few other apps do this as well.

8条回答
  •  隐瞒了意图╮
    2020-12-08 06:03

    SomeGuy's answer above worked for me. Here's the Swift translation for anyone who may need it. I made the height close to what it seems most popular apps use.

    class TabBar: UITabBar {
    
         override func sizeThatFits(size: CGSize) -> CGSize {
             var sizeThatFits = super.sizeThatFits(size)
             sizeThatFits.height = 38
    
             return sizeThatFits
         }
    }
    

提交回复
热议问题