Helo guys i found How to create rounded UIButton with top-left & bottom-left corner radius only and its working. But problem is when button have some constrains it suddenly stop workin. Can anyone help me with that i tried change everything and still no results.
As you can see on picture its working for first orange Button in top of a picture but for TWITTER button its not working. Any help please ?
extension UIButton{
func roundCorners(corners:UIRectCorner, radius: CGFloat) {
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
}
}
and this is usage ( testBtn
is that orange working button)
testBtn.roundCorners([.TopRight, .BottomRight], radius: 20)
facebookBtn.roundCorners([.TopLeft, .BottomLeft], radius: 20)
twitterBtn.roundCorners([.TopRight, .BottomRight], radius: 20)