Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bordered iOS 8 Buttons Swift

I want a flat looking white bordered around my UIButton. I would like it in Storyboard or programmatically. My code isn't working.

Code:

UIButton.layer.cornerRadius = 2;
UIButton.layer.borderWidth = 1;
UIButton.layer.borderColor = UIColor.whiteColor()
like image 588
Palash Sharma Avatar asked Jan 15 '15 12:01

Palash Sharma


1 Answers

You should create referencing outlet for your button from storyboard to your VC named for example myButton than set its properties

myButton.layer.cornerRadius = 2;
myButton.layer.borderWidth = 1;
myButton.layer.borderColor = UIColor.whiteColor().CGColor
like image 170
Zell B. Avatar answered Nov 03 '22 07:11

Zell B.