When running the code below in the iphone simulator I get the error : CGContextClosePath: no current point. Why is the current point not being set? Or is the context not set to the correct state?
CGContextBeginPath(ctx);
CGMutablePathRef pathHolder;
pathHolder = CGPathCreateMutable();
//move to point for the initial point
NSLog(@"Drawing a state point %f, %f", [[holder.points objectAtIndex:0] floatValue],
[[holder.points objectAtIndex:1] floatValue]);
CGPathMoveToPoint(pathHolder, NULL, [[holder.points objectAtIndex:0] floatValue],
[[holder.points objectAtIndex:1] floatValue]);
for(int x = 2; x < [holder.points count] - 1; x += 2)
{
NSLog(@"Drawing a state point %f, %f", [[holder.points objectAtIndex:x] floatValue],
[[holder.points objectAtIndex:(x+1)] floatValue]);
CGPathAddLineToPoint(pathHolder, NULL, [[holder.points objectAtIndex:x] floatValue],
[[holder.points objectAtIndex:(x+1)] floatValue]);
}
CGContextClosePath(ctx);
CGContextFillPath(ctx);