ios - iOs:如何在 UITabBarItem 中获得最小比例因子?
问题描述
我想在我的 UITabBarItem 中有一个自适应文本,如果它变得太大,可以最小化字体大小。
例如:
这是我的代码:
UITabBarItem.appearance().setTitleTextAttributes([NSAttributedString.Key.font: UIFont(name: "Read-Regular", size: 10)!], for: .normal)
UITabBarItem.appearance().setTitleTextAttributes([NSAttributedString.Key.font: UIFont(name: "Read-Regular", size: 10)!], for: .selected)
UITabBarItem.appearance().setTitleTextAttributes([NSAttributedString.Key.foregroundColor: UIColor.black], for: .normal)
UITabBarItem.appearance().setTitleTextAttributes([NSAttributedString.Key.foregroundColor: UIColor.white], for: .selected)
是否有任何与标签等效的选项:
valueLabel.adjustsFontSizeToFitWidth = true
valueLabel.minimumFontSize = 0.5
提前致谢。
解决方案
推荐阅读
- c# - context.SaveChanges() 返回 0;
- swift - 当其他用户不在线/离线时,聊天如何发送、阅读、接收?
- ansible - 如何在 Ansible 运行时设置变量?
- fullcalendar-4 - Fullcalendar 根据第一个日历更新第二个日历
- android - 在自定义视图中实现滚动
- r - 在 purrr::map 调用中查看底层对象
- python - 如何从 BeautifulSoup 中的项目列表中获取文本
- c# - 计算机重启后 SetDisplayConfig 的配置失效
- c# - 范围报告生成两个 HTML 报告
- java - 如何修复'java.sql.SQLException:ORA-01017:用户名/密码无效;spring-boot 中的登录被拒绝错误