1

在介绍新的系统字体中,显示了以下屏幕截图。哪个 UIFontDescriptorFeatureSettingsAttribute 用于启用此行为?

点我

4

1 回答 1

1

万一其他人为此苦苦挣扎,这是我发现的可以激活它的功能:

let descriptor = UIFont.systemFontOfSize(24.0, weight: UIFontWeightLight).fontDescriptor()
let adjusted = descriptor.fontDescriptorByAddingAttributes(
    [
        UIFontDescriptorFeatureSettingsAttribute: [
            [
                UIFontFeatureTypeIdentifierKey: kCaseSensitiveLayoutType,
                UIFontFeatureSelectorIdentifierKey: kCaseSensitiveLayoutOnSelector
            ]
        ]
    ]
)
return UIFont(descriptor: adjusted, size: 24.0)
于 2015-09-24T22:55:08.507 回答