Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to draw wavy line on iOS device

I have many points constructing a line. How can I draw a wavy line through those points?

like image 627
juliet Avatar asked Dec 07 '22 22:12

juliet


1 Answers

Example:

- (void)drawRect:(NSRect)rect
{
    NSBezierPath *curve = [NSBezierPath bezierPath];
    [curve moveToPoint:NSMakePoint(0,50)];
    [curve relativeCurveToPoint:NSMakePoint(150,50) controlPoint1:NSMakePoint(50,100) controlPoint2:NSMakePoint(100,0)]; 
    [[NSColor redColor] set];
    [curve stroke];
}

Result:

Curve.png

like image 131
Anne Avatar answered Dec 27 '22 02:12

Anne