使用CAShapeLayer改变layer的mask实现view某个角的圆角效果
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, width, 20) byRoundingCorners:UIRectCornerTopLeft | UIRectCornerBottomRight cornerRadii:CGSizeMake(10,10)]; maskPath.lineWidth=0.5f; CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init]; maskLayer.frame = CGRectMake(0, 0, width, 20) ; maskLayer.path = maskPath.CGPath; _discountLabel.layer.mask = maskLayer; _discountLabel.attributedText = discountVal; _discountTipLabel.text = _data.discountTip;