Js *_*Lim 4 objective-c transparent uiview ios

是否可以UIView用颜色创建这样的填充,但在中间是透明的?
我想在这里创造5 UIView秒.只是想知道是否可以通过仅使用一个来完成UIView
从Duncan C,我知道我应该从哪里开始,然后我发现CALayer上有透明孔.
UIBezierPath *overlayPath = [UIBezierPath bezierPathWithRect:self.view.bounds];
UIBezierPath *transparentPath = [UIBezierPath bezierPathWithRect:CGRectMake(60, 120, 200, 200)];
[overlayPath appendPath:transparentPath];
[overlayPath setUsesEvenOddFillRule:YES];
CAShapeLayer *fillLayer = [CAShapeLayer layer];
fillLayer.path = overlayPath.CGPath;
fillLayer.fillRule = kCAFillRuleEvenOdd;
fillLayer.fillColor = [UIColor colorWithRed:255/255.0 green:20/255.0 blue:147/255.0 alpha:1].CGColor;
[self.view.layer addSublayer:fillLayer];
使用2 UIBezierPath,然后填充我想要的颜色(在我的问题是粉红色),然后添加为子图层
| 归档时间: | 
 | 
| 查看次数: | 3534 次 | 
| 最近记录: |