// define
extension UIView {
func roundCorners(corners:UIRectCorner, radius: CGFloat) {
DispatchQueue.main.async {
let path = UIBezierPath(roundedRect: self.bounds, byRoundingCorners: corners, cornerRadii: CGSize(width: radius, height: radius))
let mask = CAShapeLayer()
mask.path = path.cgPath
self.layer.mask = mask
}
}
}
// using
bubbleView.roundCorners(corners: [.topLeft, .bottomRight, .topRight], radius: 21)
https://www.appcoda.com/bezier-paths-introduction/
https://www.appcoda.com/bezier-paths-introduction/
댓글 없음:
댓글 쓰기