设置View类部分圆角

// 设置一个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]
  • 例子设置了右边的两个圆角

你可能感兴趣的:(设置View类部分圆角)