CALayer の子クラスを作成し、(void)drawInContext:(CGContextRef)ctx というメソッドを書き直します。しかし、CGContextSetRGBFillColor は機能しません。助けて!
- (void)drawInContext:(CGContextRef)ctx
{
//CGContextSaveGState(ctx);
for (int i = 0; i < pointArray.count-1; i++)
{
HQPoint *point = [pointArray objectAtIndex:i];
HQPoint *pointNext = [pointArray objectAtIndex:i+1];
CGContextMoveToPoint(ctx, point.piontX, point.piontY);
CGContextAddLineToPoint(ctx, pointNext.piontX, pointNext.piontY);
}
CGContextSetRGBFillColor(ctx, 1, 0, 0, 1);
CGContextSetLineWidth(ctx, 1);
CGContextStrokePath(ctx);
//CGContextRestoreGState(ctx);
}