swift5.0任意圆角位置设置
作者:
千年积木 | 来源:发表于
2020-07-17 18:20 被阅读0次extension UIView{
///任意圆角位置设置
func setViewAnyCorner(corners:UIRectCorner.RawValue,cornerRadiii:CGSize = CGSize.init(width: 10, height: 10)) {
/*
print(UIRectCorner.topLeft.rawValue)//1
print(UIRectCorner.topRight.rawValue)//2
print(UIRectCorner.bottomLeft.rawValue)//4
print(UIRectCorner.bottomRight.rawValue)//8
*/
let bezier = UIBezierPath.init(roundedRect: self.bounds, byRoundingCorners: UIRectCorner(rawValue: corners), cornerRadii: cornerRadiii)
let layer = CAShapeLayer.init()
layer.frame = self.bounds
layer.path = bezier.cgPath
self.layer.mask = layer
}
}
本文标题:swift5.0任意圆角位置设置
本文链接:https://www.haomeiwen.com/subject/ljlnhktx.html
网友评论