0

我怎样才能将 a 转换UIFontDescriptorSymbolicTraitsCTFontSymbolicTraits

4

1 回答 1

1

看看它们是如何定义的。这是 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;

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

于 2016-03-19T22:26:16.753 回答