IOS 10.x Swift 3.0
有这个代码列出可用的字体,效果很好。但是也想要尺寸,就像你在这样的面板中看到的那样......
var fontFamilies = UIFont.familyNames as [String]
var fontNames = [String]()
var fontSizes = [String]()
func listFonts() {
for i in 0 ..< fontFamilies.count {
let fontFamily: NSString = fontFamilies[i] as NSString
let localFontNames = UIFont.fontNames(forFamilyName: fontFamilies[i]) as [String]
saveFont(fontNames: localFontNames)
}
NSLog ("%@:", fontNames)
}
但我想知道可用的尺寸,字体书从哪里获取这些信息?