快速 3 CGPathAddCurveToPoint [英] swift 3 CGPathAddCurveToPoint
问题描述
我正在尝试将代码更新为 swift 3,但我找不到有关 CGPathAddCurveToPoint 的任何信息,我该如何修复错误?
I'm trying to update code to swift 3 but I can't find anything about CGPathAddCurveToPoint, how can I fix the error?
路径是一个 CGMutablePath
path is a CGMutablePath
CGPathAddCurveToPoint(path, nil, 10, 10, 20, 20, 30, 30)
错误:nil 与预期的参数类型 'UnsafePoiter' 不兼容
error: nil is not compatible with expected argument type 'UnsafePoiter'
我发现 CGPathAddLineToPoint(path, nil, 10, 10)变成了 path.addLine(to: p0)
I found that CGPathAddLineToPoint(path, nil, 10, 10) became path.addLine(to: p0)
推荐答案
请阅读 CGMutablePath 文档:
Please read the CGMutablePath docs:
https://developer.apple.com/reference/coregraphics/cgmutablepath
你会发现:
func addCurve(to end: CGPoint, control1: CGPoint, control2: CGPoint,
transform: CGAffineTransform = default)
注意,这现在是一个方法,而不是一个松散的全局函数.
Note that this is now a method, not a loose global function.
这篇关于快速 3 CGPathAddCurveToPoint的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!