gpt4 book ai didi

ios - CGPathMoveToPoint 在创建路径时遇到一些麻烦

转载 作者:搜寻专家 更新时间:2023-11-01 06:37:53 26 4
gpt4 key购买 nike

<分区>

我使用以下代码从 CGPoint 创建路径大批()。

public func creatPath (for points:[CGPoint]) {
let path = CGMutablePath()
let startPoint = points.first

CGPathMoveToPoint( path, CGAffineTransform.identity, startPoint.x, startPoint.y)

var index = 0
for point in points {
if index == 0 { continue }
CGPathAddLineToPoint(path, nil, points.x, points.y)
index += 1
}
path.closeSubpath()
}

但它总是向我显示以下错误:

nil is not compatible with expected argument type UnsafePointer <CGAffineTransForm>

我也尝试过使用 CGAffineTransform.identity然后显示:

Cannot convert value of type 'CGAffineTransform' to expected argument type 'UnsafePointer<CGAffineTransform>'

我不确定我们还能在这里使用什么。我正在使用 Xcode8 beta 6。Swift 3.0

编辑:当我尝试时:-

var transform = CGAffineTransform.identity as CGAffineTransform;
CGPathMoveToPoint( path, &transform, startPoint.x, startPoint.y)

显示:

'CGPathMoveToPoint' is unavailable: Use move(to:transform:)

同时尝试:

CGPathMoveToPoint( path, NSNull(), startPoint.x, startPoint.y)

Error is: Cannot convert value of type 'NSNull' to expected argument type 'UnsafePointer'

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