I want a simple push button (the one with the round corners), and to add background to it. I\'ve tried 2 things:
1 - using a round button image: this is working good, un
You need to override function layoutSubviews,i.e.
override func layoutSubviews() {
self.layer.cornerRadius = self.frame.height/2
self.layer.borderColor = UIColor.blue.cgColor
self.layer.borderWidth = 2
}
I have committed a sample project here. All your related code has been written in button.swift and it is in swift 3. Also, I have not set the background image for the button, I am leaving that task up to you.
P.S.: The answer below is for UIButton, not NSButton. Probably some of it will be valid, probably not everything...