我在drawRect中使用下面的代码
CGContextSaveGState(context);
CGMutablePathRef outerPath=[self createPath:rect];
CGMutablePathRef innnerPath=[self createPath:UIEdgeInsetsInsetRect(rect, UIEdgeInsetsMake(10.0, 10.0, 10.0, 10.0)];
CGPathCloseSubpath(outerPath);
CGContextAddPath(context, outerPath);
CGContextSetFillColorWithColor(context, [UIColor colorWithRed:249.0/255.0 green:38.0/255.0 blue:1.0/255.0 alpha:1.0].CGColor);
CGContextEOFillPath(context);
CGContextDrawPath(context, kCGPathFill);
CGContextAddPath(context, innnerPath);
CGContextSetFillColorWithColor(context, [UIColor colorWithRed:50.0/255.0 green:213.0/255.0 blue:1.0 alpha:0.4].CGColor);
CGContextDrawPath(context, kCGPathFill);
CGContextRestoreGState(context);
但是,由于我使用 0.4 alpha 作为内部颜色,内部颜色变为棕色。
我怎么能有这样的东西,如下所示?