自由设置矩形的四个角为圆角
UIView *progress = [[UIView alloc] init];
progress.backgroundColor = [UIColor redColor];
progress.frame = CGRectMake(20, 20, 300, 50);
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:progress.bounds byRoundingCorners:UIRectCornerBottomLeft|UIRectCornerTopLeft cornerRadii:CGSizeMake(25, 25)];
CAShapeLayer * maskLayer = [[CAShapeLayer alloc] init];
maskLayer.frame = progress.bounds;
maskLayer.path = maskPath.CGPath;
progress.layer.mask = maskLayer;
[self.view addSubview:progress];