Cut CGPath from UIView

87 views Asked by At

I have the following code:

CAShapeLayer* lay = [CAShapeLayer layer];
lay.path = [UIBezierPath bezierPathWithArcCenter:CGPointMake(150, 150) radius:40 startAngle:0 endAngle:360 clockwise:YES].CGPath;

lay.fillRule = kCAFillRuleEvenOdd;
self.contentView.layer.mask = lay;

At

At left is what I want, at right is what I get.

I want to cut a circular hole from the contentView, this code masks it to the specified path but this is not I want. Thanks in advance.

0

There are 0 answers