![](/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.