更改 tabbaritem 的字体大小
是否可以更改选项卡的字体大小?
Is it possible to change the font size of tabs?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
是否可以更改选项卡的字体大小?
Is it possible to change the font size of tabs?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(12)
我推荐一个更好的方法:
I recommend a better way:
[更新] iOS 7.0+ 版本 @cancer86 的好答案:
主要变化是 UITextAttributeTextColor 和 UITextAttributeFont 均已弃用,
以便将其应用于所有选项卡(感谢 @ToolmakerSteve 指出)
[Update] iOS 7.0+ version of @cancer86's nice answer:
The main change is that UITextAttributeTextColor and UITextAttributeFont are both deprecated
In order to apply it to all tabs (thanks to @ToolmakerSteve for pointing out)
在 iOS 5.0 或更高版本中很简单:
Simple in iOS 5.0 or later:
我认为 Swift 中的这可以清晰地控制选项卡栏颜色和文本属性。
I think this in Swift gives a clear control over the tab bar colors and text attributes.
[将其留在这里供我自己参考,只是对其他工作答案的即兴发挥。对于我来说,这是针对 iOS 7 的修复,这有点超出了问题......]
缺少的方法是
[leaving this here for my own reference, just a riff off the other working answers. For mem it's a fix for iOS 7, which is beyond the question by a bit...]
the missing method is
其实是有办法的。
Actually there is a way.
您可以从自定义扩展类更改选项卡栏项目字体属性。
例如,
import UIKit
现在您可以从属性检查器
如果有更好的方法请指出!
you can change tab bar item font attributes from the custom extension class.
for example,
import UIKit
if there is a better way please mention it!
你必须从ios 13开始改变这样做的方式
You must change the way to do it from ios 13