测试已测试 | ✗ |
语言语言 | SwiftSwift |
许可协议 | MIT |
发布最新发布 | 2015年5月 |
SPM支持 SPM | ✗ |
由 Frederik Jacques 维护。
当你在 iOS 项目中使用自定义字体时,在用 UIFont(name:String, size:CGFloat)
工作时你需要正确的字体名称。字体名称并不总是与文件名相同,所以使用这个扩展你可以轻松地找到你的自定义字体名称。
这个扩展在 UIFont 中枚举了设备上所有可用的字体家族及其字体名称。
在你想使用类方法的文件中导入模块。
import UIFont_Enumerate
然后只需调用类方法 enumerateFonts
。
UIFont.enumerateFonts()
这将导致控制台中出现以下输出。
[UIFont] Start enumerating 75 font families.
1. Font family = Thonburi
- 1) Font name = Thonburi-Bold
- 2) Font name = Thonburi
- 3) Font name = Thonburi-Light
...
75. Font family = Bodoni 72 Smallcaps
- 1) Font name = BodoniSvtyTwoSCITCTT-Book
[UIFont] End enumerating
UIFont-Enumerate 通过 CocoaPods 提供。要安装它,只需将以下行添加到 Podfile 中:
pod "UIFont-Enumerate"
Frederik Jacques, [email protected]
UIFont-Enumerate 在 MIT 许可协议下提供。请参阅 LICENSE 文件以获取更多信息。