I want to set the Top/Bottom Left corner radius of UIButton. How can i achieve this?
If i use button.layer.cornerRadius
, it'll set all the corners.
I've tried using UIBazierPath, but probably i'm doing something wrong and the button is not appearing correctly. The code i've used is:
let path = UIBezierPath(roundedRect: button.bounds, byRoundingCorners: [.TopLeft, .BottomLeft], cornerRadii: CGSize(width: 3.0, height: 3.0))
let mask = CAShapeLayer()
mask.path = path.CGPath
button.layer.mask = mask
I've tried the answers from stackoverflow i.e this but it's not working for me. It's updating the corners but reducing button's height as well. I think i'm doing something wrong with frame/bounds.
Using above code, the UIButton appears as:
Another solution i used was to use the image with rounded corners. but now i want to do this programmatically.
Thanks.