let cornerPath = UIBezierPath(roundedRect: myView.bounds, byRoundingCorners: [.bottomLeft, .topLeft], cornerRadii:  CGSize(width: 8, height:  8))
 let maskLayer = CAShapeLayer()
 maskLayer.path = cornerPath.cgPath
 myView.layer.mask = maskLayer
UIBezierPath參數內容:roundedRect:要做mask的UIView的bounds。
byRoundingCorners:要做圓弧角的地方,有左上、左下、右上、右下,也有全部都要的allCorners可以用。
cornerRadii:圓角大小,CGSize物件,寬度=水平弧度,高度=垂直弧度。詳細可以看這篇:Why is cornerRadii parameter of CGSize type in...。

沒有留言:
張貼留言
歡迎大家留言提問,我會答的都會盡力回答!
如果太久沒出現回應就是我又忘記回來看留言了TAT