私は CAShapeLayer を使用してジグソー パズルを描いています。簡単な部分である線を描くこともできました。しかし、今はその楕円の一部を切り取って楕円を描きたいと思っています。私の質問は、CGPathAddEllipseInRect を使用して楕円を切り取る方法です。コード:
CAShapeLayer *shapeLayer = [CAShapeLayer layer];
[shapeLayer setBounds:self.bounds];
[shapeLayer setPosition:self.center];
[shapeLayer setFillColor:[[UIColor clearColor] CGColor]];
[shapeLayer setStrokeColor:[[UIColor blackColor] CGColor]];
[shapeLayer setLineWidth:3.0f];
// Setup the path
CGMutablePathRef path = CGPathCreateMutable();
CGPathMoveToPoint(path, NULL, 10, 10);
CGPathAddLineToPoint(path, NULL, 75,10);
CGPathAddEllipseInRect(path, NULL, CGRectMake(75, 10, 50, 20));
[shapeLayer setPath:path];
CGPathRelease(path);
[[self layer] addSublayer:shapeLayer];
ヒントをいただければ幸いです。