swift - 设置 UITabBarItem 属性文本不起作用
问题描述
我想更改标签栏的文本样式、字体和颜色。我已经尝试过外观代理方法AppDelegate
但它不起作用,然后我尝试单独调用setTitleTextAttributes()
每个UITabBarItem
,它也不起作用。我很沮丧(iOS 13)!
let appearance = UITabBarItem.appearance()
appearance.setTitleTextAttributes([NSAttributedString.Key.foregroundColor: UIColor.red], for: .normal)
appearance.setTitleTextAttributes([NSAttributedString.Key.foregroundColor: UIColor.green], for: .selected)
以上不起作用
唯一能改变默认颜色的方法是通过UITabBar
外观代理设置色调颜色AppDelegate
:
UITabBar.appearance().tintColor = UIColor.black
我不能用这个改变字体。iOS13有变化吗?我在 Appel 文档中找不到任何关于它的信息。
解决方案
推荐阅读
- ios - 试图访问由另一个场景委托函数在场景委托中创建的环境对象
- r - 用于在我的 DataFrame R 中汇总数据的包
- php - 输出值: A_CONSTANT 。来自 YAML Vagrant 配置的“连接到字符串”
- bash - 使用 Bash 将单词从一个文件复制到另一个文件
- javascript - 使用 Java Script 以编程方式在 Google Meet 中取消麦克风静音
- r - 按列中的值过滤 R 中的相似行并粘贴结果
- java - Microsoft.Azure.Storage.Common:无法建立连接,因为目标机器主动拒绝
- r - 如何将两个求和函数组合到一个代码中,该代码将以以下样式提供作为表格的输出?
- python - 如何在 PySpark 中转换“/Date(epoch time)/”字符串
- angular - 为什么在初始加载父组件时子组件被调用四次?