ios-在视图上挖个洞
程序员文章站
2022-07-03 15:08:18
view背景为黑色半透明,右下角挖一个矩形显示底部图层。_tapView = [[UIView alloc] initWithFrame:self.view.bounds]; _tapView.backgroundColor = [UIColor colorWithWhite:0 alpha:.5]; // 贝塞尔绘制区域 UIBezierPath *path = [UIBezierPath bezierPathWithRect:self.view.bo...
view背景为黑色半透明,右下角挖一个矩形显示底部图层。
_tapView = [[UIView alloc] initWithFrame:self.view.bounds];
_tapView.backgroundColor = [UIColor colorWithWhite:0 alpha:.5];
// 贝塞尔绘制区域
UIBezierPath *path = [UIBezierPath bezierPathWithRect:self.view.bounds];
// 扣出右下角矩形区域
[path appendPath:[[UIBezierPath bezierPathWithRoundedRect:smallRect cornerRadius:5] bezierPathByReversingPath]];
CAShapeLayer *shapeLayer = [CAShapeLayer layer];
shapeLayer.path = path.CGPath;
// 约束layer
[_tapView.layer setMask:shapeLayer];
二维码扫描,用户指引等功能界面会用到。
本文地址:https://blog.csdn.net/u011248221/article/details/107554765
推荐阅读