PHP中文网2017-04-17 13:38:48
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).
大家讲道理2017-04-17 13:38:48
Wouldn’t it be nice to cover a fully transparent UIView with a translucent picture with a hollow in the middle
阿神2017-04-17 13:38:48
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