How to draw wavy line on iOS device

后端 未结 3 1666
悲&欢浪女
悲&欢浪女 2020-12-29 16:14

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

3条回答
  •  再見小時候
    2020-12-29 16:57

    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

提交回复
热议问题