Skip to content

@warrenm /SPPlotView.m
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Demonstration of using Core Graphics to draw a sine wave at an arbitrary frequency
[[UIColor colorWithRed:0 green:192/255.0 blue:255/255.0 alpha:1] set];
CGContextSetLineWidth(context, 1);
CGContextSetLineJoin(context, kCGLineJoinRound);
const CGFloat amplitude = halfHeight / 4;
for(CGFloat x = 0; x < width; x += 0.5)
{
CGFloat y = amplitude * sinf(2 * M_PI * (x / width) * frequency) + halfHeight;
if(x == 0)
CGContextMoveToPoint(context, x, y);
else
CGContextAddLineToPoint(context, x, y);
}
CGContextStrokePath(context);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.