我试图CTFrameGetLineOrigins
从这里弄清楚:CTFrameGetLineOrigins Got Incorrect Origins,并试图将 ObjC 转换为 Swift。
对象-C:
CFArrayRef lines = CTFrameGetLines(frame);
size_t numOfLines = CFArrayGetCount(lines);
CGPoint lineOrigins[numOfLines];
CTFrameGetLineOrigins(frame, CFRangeMake(0, 0), lineOrigins);
迅速:
let lines = CTFrameGetLines(frame)
let numOfLines: size_t = CFArrayGetCount(lines)
let lineOrigins = [CGPoint](repeating: CGPoint.zero, count: numOfLines)
CTFrameGetLineOrigins(frame, CFRangeMake(0, 0), lineOrigins)
但是我收到 CTFrameGetLineOrigins 的第三个参数的错误:
无法将类型“[CGPoint]”的值转换为预期的参数类型“UnsafeMutablePointer”
我如何克服这个错误?