代碼中實現
view.layer.cornerRadius = 2 //圓角弧度
view.layer.masksToBounds = true //是否把圓角邊切去
view.layer.borderWidth = 1 //設置邊框 的寬度
view.layer.borderColor = UIColor.redColor.CGColor //設置邊框的顏色
在xib中實現
點擊User Defined Runtime Attributes 的➕號
設置弧度
Key Path : layer.cornerRadius
Type : Number
Value : 2
切去圓角
Key Path : layer.masksToBounds
Type : Boolean
Value : ☑️