I have made an application which draws a number of curves, using UIBezierPath. Now I’m trying to implement a modification functionality in it. To modify the particular curve one thing I can do is to draw all the curves again; I have not yet implemented this. But I think this algorithm would not be very efficient when the number of curves increases because I have to store all the points in the array and I have to run for loop to draw each curve every time I go for modification.
I am looking for more efficient algorithm. It will be helpful if someone can provide example code.
You can represent individual curves as
UIBezierPaths and draw them separately by creating oneCAShapeLayerper curve and assigning the shape layer’spathproperty to the correspondingCGPathproperty of the bezier path. To update an individual curve, you then just have to manipulate one bezier path and the corresponding shape layerspathproperty.