Well, I applied the sine wave in the drawward UIView method as follows:
float x=75; float yc=50; float w=0; while (w<=rect.frame.size.width) { CGPathMoveToPoint(path, nil, w,y/2); CGPathAddQuadCurveToPoint(path, nil, w+x/4, -yc,w+ x/2, y/2); CGPathMoveToPoint(path, nil, w+x/2,y/2); CGPathAddQuadCurveToPoint(path, nil, w+3*x/4, y+yc, w+x, y/2); CGContextAddPath(context, path); CGContextDrawPath(context, kCGPathStroke); w+=x; }
Here x is the width of each sine wave, and y is the frame height. This will cause the number of sine waves to match the entire UIViewFrame. This would create a clear sine wave, and yc a control stick. Try it, you may like it.
If the width, i.e. x is similar to the width of the frame, then a sine wave will be created.
Total sine wave number = (frame width) / ('x' width of each sine wave)
source share