Skip to content

Instantly share code, notes, and snippets.

@gsanthosh91
Created April 16, 2019 17:50
Show Gist options
  • Select an option

  • Save gsanthosh91/7bcaaf3eb2c44fdce2aa903e273714db to your computer and use it in GitHub Desktop.

Select an option

Save gsanthosh91/7bcaaf3eb2c44fdce2aa903e273714db to your computer and use it in GitHub Desktop.
iOS button with corner radious
import Foundation
import UIKit
class SAButton: UIButton {
override init(frame: CGRect) {
super.init(frame: frame)
setupButton()
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
setupButton()
}
private func setupButton() {
backgroundColor = UIColor.blue
titleLabel?.font = UIFont(name: "HelveticaNeue-Bold", size: 22)
layer.cornerRadius = frame.size.height/2
setTitleColor(.white, for: .normal)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment