changing the height of UITabBar in iOS7/8?

前端 未结 8 2097
轮回少年
轮回少年 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:10

    If you have auto layout enabled, you will need to override instrinsicContentSize instead

    Proper usage of intrinsicContentSize and sizeThatFits: on UIView Subclass with autolayout

    class TabBar: UITabBar {
        override func intrinsicContentSize() -> CGSize {
            var intrinsicSize = super.frame.size
    
            intrinsicSize.height = 120
            return intrinsicSize
         }
    }
    

提交回复
热议问题