iOS 视图画半圆

let  maskPath = UIBezierPath.init(roundedRect: box, byRoundingCorners: [.topRight,.topLeft], cornerRadii: CGSizeMake(width: 6.0, height: 6.0))

let maskLayer = CAShapeLayer()

maskLayer.frame = self.bgView.bounds

maskLayer.path = maskPath.cgPath

self.bgView.layer.mask = maskLayer

你可能感兴趣的:(iOS 视图画半圆)