设置View类部分圆角
2016-12-17 本文已影响8人
阴中阳
// 设置一个View类型的半边圆角A
let path = UIBezierPath(roundedRect: Setting.bounds, byRoundingCorners: [UIRectCorner.topRight, UIRectCorner.bottomRight], cornerRadii: CGSize(width: 5, height: 5))
let shapeLayer = CAShapeLayer()
shapeLayer.path = path.cgPath
Setting.layer.mask = shapeLayer
- 只需要修改[UIRectCorner.topRight, UIRectCorner.bottomRight]
- 例子设置了右边的两个圆角