This is my Xib. I just dragged a UIButton and changed its background color.
I created a semi circle layer using this code
let circlePath = UIBezierPath.init(arcCenter: CGPointMake(mybutton.bounds.size.width / 4, 0), radius: mybutton.bounds.size.height, startAngle: 0.0, endAngle: CGFloat(M_PI), clockwise: true)
let circleShape = CAShapeLayer()
circleShape.path = circlePath.CGPath
mybutton.layer.mask = circleShape
and this is my output.
Its perfect as I want it. But the problem is that this button is clickable outside its rounded area(as per actuall shape of button). I want it to be clickable only as rounded shape.
How can I achieve this ? Thanks.