Reputation: 916
i have four button.
And two button have round corner (1-(top Left, bottom Left),4-(top Right, bottom Right)).
How can i change border color how on image.
// Right Button
let T1 = UIBezierPath(roundedRect:Delete.bounds, byRoundingCorners:[.topRight, .bottomRight], cornerRadii: CGSize(width: 15, height: 15))
let maskLayer = CAShapeLayer()
maskLayer.path = T1.cgPath
Delete.layer.mask = maskLayer
// Left Button
let T2 = UIBezierPath(roundedRect:Copy.bounds, byRoundingCorners:[.topLeft, .bottomLeft], cornerRadii: CGSize(width: 15, height: 15))
let maskLayer2 = CAShapeLayer()
maskLayer2.path = T2.cgPath
Copy.layer.mask = maskLayer2
Upvotes: 2
Views: 1431
Reputation: 227
button.layer.borderColor = CGColor(srgbRed: 255/255, green: 126/255, blue: 121/255, alpha: 1)
Upvotes: 1
Reputation: 20804
Add your UIView
"containerView" as IBOutlet
and setup your containerView.layer.borderWidth = yourDesiredWidth
and setup the containerView.layer.borderColor = yourNeededColor.cgColor
Upvotes: 4
Reputation: 1634
UIButton.layer.cornerRadius
, UIButton.layer.borderColor
, and UIButton.layer.borderWidth
. layer
is a property of UIView
, so you can pretty much customize any view with it.
Upvotes: 2