gpt4 book ai didi

ios - swift 2.0 将 UIFontDescriptorSymbolicTraits 转换为 CTFontSymbolicTraits

转载 作者:行者123 更新时间:2023-11-29 01:08:07 25 4
gpt4 key购买 nike

如何将 UIFontDescriptorSymbolicTraits 转换为 CTFontSymbolicTraits

最佳答案

看看它们是如何定义的。这是 CTFontSymbolicTraits:

enum {
kCTFontItalicTrait = (1 << 0),
kCTFontBoldTrait = (1 << 1),
kCTFontExpandedTrait = (1 << 5),
kCTFontCondensedTrait = (1 << 6),
// ...
};
typedef uint32_t CTFontSymbolicTraits;

这是 UIFontDescriptorSymbolicTraits:

typedef enum : uint32_t {
UIFontDescriptorTraitItalic = 1u << 0,
UIFontDescriptorTraitBold = 1u << 1,
UIFontDescriptorTraitExpanded = 1u << 5,
UIFontDescriptorTraitCondensed = 1u << 6,
// ...
} UIFontDescriptorSymbolicTraits;

注意到什么了吗?就对您而言重要的特征而言,它们实际上是相同的。无需转换。

关于ios - swift 2.0 将 UIFontDescriptorSymbolicTraits 转换为 CTFontSymbolicTraits,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36104082/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com