I have designed this code to generate a Bezier Path that is used as a path for a CAShapeLayer to mask a UIView (the view\'s height and width are variable)
This code
Is much much more less complicated would be just adding two lines of code:
UIBezierPath *bezierPath = [UIBezierPath bezierPath];
bezierPath.lineCapStyle = kCGLineCapRound;
bezierPath.lineJoinStyle = kCGLineJoinRound;
CGPoint center = CGPointMake(rect.size.width / 2, 0);
...
EDIT:
To see that corners are rounded you need to make triangle a little less than rect bounds:
CGPoint center = CGPointMake(rect.size.width / 2, 10);
CGPoint bottomLeft = CGPointMake(10, rect.size.height - 10);
CGPoint bottomRight = CGPointMake(rect.size.width - 10, rect.size.height - 10);