swift 3 CGPathAddCurveToPoint

坚强是说给别人听的谎言 提交于 2019-12-25 18:21:55

问题


I'm trying to update code to swift 3 but I can't find anything about CGPathAddCurveToPoint, how can I fix the error?

path is a CGMutablePath

CGPathAddCurveToPoint(path, nil, 10, 10, 20, 20, 30, 30)

error: nil is not compatible with expected argument type 'UnsafePoiter'

I found that CGPathAddLineToPoint(path, nil, 10, 10) became path.addLine(to: p0)


回答1:


Please read the CGMutablePath docs:

https://developer.apple.com/reference/coregraphics/cgmutablepath

You will find:

func addCurve(to end: CGPoint, control1: CGPoint, control2: CGPoint, 
    transform: CGAffineTransform = default)

Note that this is now a method, not a loose global function.



来源:https://stackoverflow.com/questions/39554110/swift-3-cgpathaddcurvetopoint

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!