如何在swift 3.0中获得给定UIfont的可用大小列表

时间:2016-10-24 04:28:13

标签: ios swift fonts uifont

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)
}

但我想知道可用的尺寸,字体书从哪里获取这些信息?

enter image description here

0 个答案:

没有答案