I want to make a button with top left and botton left corner radius = 15 so i make this class to achive it
class pathBUtton:UIBUtton{
override func layoutSubviews() {
super.layoutSubviews()
let shapeLayer = CAShapeLayer()
let path = UIBezierPath.init(roundedRect: self.bounds, byRoundingCorners: [.topLeft,.bottomLeft], cornerRadii: CGSize.init(width: 15.0, height: 0.0))
shapeLayer.lineWidth = 5.0
shapeLayer.fillColor = UIColor.blue.cgColor
shapeLayer.path = path.cgPath
shapeLayer.strokeColor = UIColor.clear.cgColor
self.backgroundColor = UIColor.clear
self.layer.addSublayer(shapeLayer)
}
after setting button class in IB to pathButton, the button text is not shown see image and also the cashapelayer is not fitting the button frame, the white seen behinde the blue. the blue part is the button, the white is the view containig the button an a label an other button. in the view controller i have set the views cornerradius to 15 as this
valoraView.layer.cornerRadius = 15
but there is a diference between the radius of the view and the radius of the shapelayer in the path. so any help would be apreciated