-2

How do I change the border color of a button?

rmaddy
  • 314,917
  • 42
  • 532
  • 579

2 Answers2

1

Take a look at CALayer. Every UIView has a ‘layer’ property on which you can set a borderWidth, color, etc...

0

Put inside your viewDidLoad method inside ViewController:

yourButtonProperty.layer.borderColor = UIColor.black.cgColor

Replace yourButtonProperty with property for your Button. Docs for CALayer: https://developer.apple.com/documentation/quartzcore/calayer

Andrei Konstantinov
  • 6,971
  • 4
  • 41
  • 57