问题
I'm familiar with UIBezierPath and the corresponding CG routines, but none of them appear to draw the same type of path as what I see in Photoshop, etc.
How would one go about this? I'm just talking about the UI--letting the user drag around points.
A java example I found is here: http://www.cse.unsw.edu.au/~lambert/splines/natcubic.html
回答1:
I would look into CGContextAddCurveToPoint and drag around curve's control points. If you require more control points to create a complex curve, just split a resulting curve into simple segments.
Take a look at this article It explains how to calculate the control points based on knots you have on your curve.
来源:https://stackoverflow.com/questions/8013717/how-to-implement-a-photoshop-curves-editor-in-uikit