gpt4 book ai didi

ios - 无法将类型 'CGPoint!' 的值转换为预期的参数类型 'UnsafeMutablePointer'

转载 作者:可可西里 更新时间:2023-11-01 02:17:15 24 4
gpt4 key购买 nike

我遇到了快速构建错误。

func pathRefFromText() -> CGPathRef {

let attributed : NSAttributedString = self.attrubutedText
let line : CTLineRef = CTLineCreateWithAttributedString(attributed as! CFAttributedStringRef)
let runArray : CFArrayRef = CTLineGetGlyphRuns(line)
for var runIndex = 0; runIndex < CFArrayGetCount(runArray); runIndex++ {
let run: CTRunRef = (CFArrayGetValueAtIndex(runArray, runIndex) as! CTRunRef)
// let runFont : CTFontRef = CFDictionaryGetValue(CTRunGetAttributes(run), kCTFontAttributeName)
for(var runGlyphIndex = 0; runGlyphIndex < CTRunGetGlyphCount(run); runGlyphIndex++)
{
let thisGlyphRange : CFRange = CFRangeMake(runGlyphIndex, 1)
let glyph : CGGlyph!
let position : CGPoint!

// The build error comes in these two lines
CTRunGetGlyphs(run, thisGlyphRange, glyph)
CTRunGetPositions(run, thisGlyphRange, position)

}
}
}

我收到一个构建错误,提示无法转换“CGPoint!”类型的值到预期的参数类型 'UnsafeMutablePointer'

最佳答案

尝试使用:

var glyph : CGGlyph = CGGlyph()
var position : CGPoint = CGPoint()

CTRunGetGlyphs(run, thisGlyphRange, &glyph)
CTRunGetPositions(run, thisGlyphRange, &position)

关于ios - 无法将类型 'CGPoint!' 的值转换为预期的参数类型 'UnsafeMutablePointer<CGPoint>',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36308100/

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