Search code examples
uitabbarcontrolleruitabbar

changing the height of UITabBar in iOS7/8?


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.

however, when i try to set the height it still remains the same

self.tabBar.frame.height = 40

are we not allowed to change the tab bar height? and if so what is a good alternative? using a toolbar?


Solution

  • 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
         }
    }