一个背景黑色50%透明,中间镂空一个全透明的区域该怎么弄?
业精于勤,荒于嬉;行成于思,毁于随。
When drawing View, use layer.mask to add a picture mask to the layer (you can make a gray and white picture, black is displayed, white is not displayed, and gray represents translucency).
Wouldn’t it be nice to cover a fully transparent UIView with a translucent picture with a hollow in the middle
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
When drawing View, use layer.mask to add a picture mask to the layer (you can make a gray and white picture, black is displayed, white is not displayed, and gray represents translucency).
Wouldn’t it be nice to cover a fully transparent UIView with a translucent picture with a hollow in the middle
let path = UIBezierPath(rect:self.view.bounds)