色または背景画像で塗りつぶす必要がある次の形状があります。
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSaveGState(context);
CGMutablePathRef pPath_0 = CGPathCreateMutable();
CGPathMoveToPoint(pPath_0, NULL, 72.61 / 2 + xCoordinates,20.21 / 2 + yCoordinates);
CGPathAddLineToPoint(pPath_0, NULL, 69.19 / 2 + xCoordinates,16.37 / 2 + yCoordinates);
CGPathAddLineToPoint(pPath_0, NULL, 26.02 / 2 + xCoordinates,16.37 / 2 + yCoordinates);
CGPathAddLineToPoint(pPath_0, NULL, 22.69 / 2 + xCoordinates,20.21 / 2 + yCoordinates);
CGPathAddCurveToPoint(pPath_0, NULL, 22.69 / 2 + xCoordinates,20.21 / 2 + yCoordinates,17.69 / 2 + xCoordinates,24.84 / 2 + yCoordinates,17.69 / 2 + xCoordinates,34.71 / 2 + yCoordinates);
CGPathAddLineToPoint(pPath_0, NULL, 17.69 / 2 + xCoordinates,194.87 / 2 + yCoordinates);
CGPathAddCurveToPoint(pPath_0, NULL, 17.69 / 2 + xCoordinates,194.87 / 2 + yCoordinates,20.87 / 2 + xCoordinates,206.37 / 2 + yCoordinates,47.69 / 2 + xCoordinates,206.37 / 2 + yCoordinates);
CGPathAddLineToPoint(pPath_0, NULL, 48.69 / 2 + xCoordinates,206.37 / 2 + yCoordinates);
CGPathAddCurveToPoint(pPath_0, NULL, 75.69 / 2 + xCoordinates,206.37 / 2 + yCoordinates,77.69 / 2 + xCoordinates,194.87 / 2 + yCoordinates,77.69 / 2 + xCoordinates,194.87 / 2 + yCoordinates);
CGPathAddLineToPoint(pPath_0, NULL, 77.69 / 2 + xCoordinates,34.71 / 2 + yCoordinates);
CGPathAddCurveToPoint(pPath_0, NULL, 77.69 / 2 + xCoordinates,24.84 / 2 + yCoordinates,72.61 / 2 + xCoordinates,20.21 / 2 + yCoordinates,72.61 / 2 + xCoordinates,20.21 / 2 + yCoordinates);
CGPathCloseSubpath(pPath_0);
CGContextSetRGBStrokeColor(context,0.0000,0.0000,0.0000,1.0000);
CGContextSetLineWidth(context, 1);
CGContextSetMiterLimit(context, 10.0000);
CGContextAddPath(context, pPath_0);
CGContextDrawPath(context, kCGPathStroke);
CGPathRelease(pPath_0);
CGContextRestoreGState(context);
次のコードを使用して形状を赤色で塗りつぶそうとしていますが、機能しません。
CGContextSetFillColorWithColor(context, [UIColor redColor].CGColor);
CGContextDrawPath(context, kCGPathFill);
CGContextFillPath(context);
私は何が欠けていますか?