一个背景黑色50%透明,中间镂空一个全透明的区域该怎么弄?
let path = UIBezierPath(rect:self.view.bounds)
path.appendPath(UIBezierPath(rect: CGRect(x: 100, y: 100, width: 200, height: 300)).bezierPathByReversingPath())
let shape = CAShapeLayer()
shape.path = path.CGPath
blurView.layer.mask = shape
2 回答1k 阅读
1 回答1.1k 阅读✓ 已解决
1 回答2.7k 阅读
1 回答1.5k 阅读
1 回答1.4k 阅读
1.7k 阅读
1 回答902 阅读
绘制View的时候用layer.mask给layer加个图片蒙版(可以做一张灰白图片,黑色显示,白色不显示,灰色代表半透明)。