更改 iOS7/8 中 UITabBar 的高度? [英] changing the height of UITabBar in iOS7/8?

查看:28
本文介绍了更改 iOS7/8 中 UITabBar 的高度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将库存 UITabBar 的高度更改为 44px,类似于 Tweetbot 的标签栏高度.我还看到其他一些应用也这样做.

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?

推荐答案

上述 SomeGuy 的回答对我有用.这是适用于可能需要它的任何人的 Swift 翻译.我使高度接近似乎最流行的应用程序使用的高度.

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

这篇关于更改 iOS7/8 中 UITabBar 的高度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆