Bordered iOS 8 Buttons Swift Bordered iOS 8 Buttons Swift swift swift

Bordered iOS 8 Buttons Swift


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


You don't have to do this with code either. You can create a stretchable image and set it to the background image of the button in the attributes inspector.

enter image description here


as 0x7fffffff said. UIButton is the class it can be instatiated bu invoking its constructor like this

let instanceOfUIButton = UIButton()

then you can set the desired attributes:

instanceOfUIButton.layer.cornerRadius = 2;