镂空效果

144 阅读1分钟

镂空效果

        let bpath = UIBezierPath.init(rect: self.bounds)
        bpath.append(UIBezierPath.init(roundedRect: CGRect.init(x: 1, y: 16, width: self.width - 2, height: self.height - 32), cornerRadius: 8).reversing())
        let layer = CAShapeLayer.init()
        layer.path = bpath.cgPath
        self.layer.mask = layer