func createPartRadius(view:UIView,cornerRadius:CGSize,corner:UIRectCorner) {
let maskPath =UIBezierPath.init(roundedRect: view.bounds, byRoundingCorners:corner, cornerRadii:cornerRadius)
let maskLayer =CAShapeLayer()
maskLayer.frame= view.bounds
maskLayer.path= maskPath.cgPath
view.layer.mask= maskLayer
}
使用方法
createPartRadius(view:self.btn, cornerRadius:CGSize(width:7.5, height:7.5), corner: [.topLeft,.bottomLeft])
网友评论