gpt4 book ai didi

ios - 使用 objective-c 更改选定 UITabBarItem 的字体

转载 作者:行者123 更新时间:2023-11-28 21:10:17 25 4
gpt4 key购买 nike

如果选中,我想将选中的 UITabBarItem 的字体更改为粗体。我已经按照以下步骤将图像和文本设置为白色,还设置了字体,但只有选择 UITabBarItem 时颜色会发生变化,字体不会发生变化。

// Normal font       
[self.tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:MY_LIGHT_FONT, NSFontAttributeName, [UIColor grayColor], NSForegroundColorAttributeName,nil] forState:UIControlStateNormal];

// Selected font
[self.tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:MY_BOLD_FONT, NSFontAttributeName, [UIColor whiteColor], NSForegroundColorAttributeName,nil] forState:UIControlStateSelected];

所选字体不会改变任何内容。

enter image description here

日历文本应该是粗体。

最佳答案

正如@TimurBernikowich 所提到的,字体参数不适用于 iOS11 上的选定状态

关于ios - 使用 objective-c 更改选定 UITabBarItem 的字体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43759314/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com