我试着用一个圆的直角夹起一个直角,因为直角的宽度可以是这样的,只需要画出角的一部分。总有一个背景四舍五入。
我有以下的,填充的颜色是剪裁,但我也有一个灰色的背景剪辑。我需要做点什么才能摆脱这一切吗?
// Cell
UIBezierPath *cell = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, 133, 55) cornerRadius:10];
[[UIColor greyColor] setFill];
[cell fill];
// Level
UIBezierPath *level = [UIBezierPath bezierPathWithRect:CGRectMake(0, 0, 129, 55)];
[level fill];
UIBezierPath *clipPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, 133, 55) cornerRadius:10];
clipPath.usesEvenOddFillRule = YES;
CGContextSaveGState(UIGraphicsGetCurrentContext()); {
[clipPath addClip];
[color setFill];
[level fill];
} CGContextRestoreGState(UIGraphicsGetCurrentContext());
UIBezierPath *contact = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(135, 19, 5, 17) byRoundingCorners: UIRectCornerTopRight | UIRectCornerBottomRight cornerRadii:CGSizeMake(2.5, 2.5)];
[color setFill];
[contact fill];发布于 2013-09-18 12:20:22
灰色填充没有被裁剪的原因是因为它发生在剪辑被添加到上下文之前。
您在裁剪之前和之后都在执行[level fill];。在剪裁之前把它移开,它应该能工作。
https://stackoverflow.com/questions/18870621
复制相似问题