![](/img/trans.png)
[英]Swift returns 'UInt32' is not convertible to 'CGImage'
[英]NSGlyph to CGGlyph in Swift (UInt32 to UInt16)
如何从NSGlyph转换为CGGlyph?
let ctGlyph = glyph as CGGlyph
我看到:
typealias CGGlyph = CGFontIndex
typealias CGFontIndex = UInt16
typealias NSGlyph = UInt32
那么我该如何进行类型转换呢?
我试过了:
let ctGlyph = glyph as CGGlyph
但这给了我:
错误:“ NSGlyph”不可转换为“ CGGlyph”
您不能强制转换,但可以使用初始化程序:
let ctGlyph = CGGlyph(glyph)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.