I need to create a button with an upper left and lower left corner radius like this
. I tried to create the following extension, which was taken from one of stackoverflow's answers:
extension UIButton {
func roundCorners(corners:UIRectCorner, radius: CGFloat) {
self.layer.borderColor = GenerateShape.UIColorFromHex(0x989898, alpha: (1.0-0.3)).CGColor
self.layer.borderWidth = 1.0
let path = UIBezierPath(roundedRect: self.bounds, byRoundingCorners: corners, cornerRadii: CGSize(width: radius, height: radius))
let mask = CAShapeLayer()
mask.path = path.CGPath
self.layer.mask = mask
}
}
then the method is called as follows:
self.collectionBtn.roundCorners(.TopLeft | .BottomLeft, radius: cornerRadius)
this code generates the following form 
So why are the upper left and lower left angles invisible? What to do to make them visible?
source
share