📜  如何在 swiftui 中添加角 - Swift 代码示例

📅  最后修改于: 2022-03-11 15:01:02.904000             🧑  作者: Mango

代码示例2
extension UIView {
   func roundCorners(corners: UIRectCorner, radius: CGFloat) {
        let path = UIBezierPath(roundedRect: bounds, byRoundingCorners: corners, cornerRadii: CGSize(width: radius, height: radius))
        let mask = CAShapeLayer()
        mask.path = path.cgPath
        layer.mask = mask
    }
}