原文链接:https://blog.csdn.net/timtian008/article/details/80702462
+ (instancetype)bezierPathWithRoundedRect:(CGRect)rect cornerRadius:(CGFloat)cornerRadius
设置视图部分圆角问题,只需要设置 layer.cornerRadius
UIRectCorner有五种
UIRectCornerTopLeft //上左
UIRectCornerTopRight //上右
UIRectCornerBottomLeft // 下左
UIRectCornerBottomRight // 下右
UIRectCornerAllCorners // 全部
failLabel = [UILabel new];
failLabel.textColor = [UIColor whiteColor];
failLabel.font = APP_TEXT_FONT_20;
failLabel.backgroundColor = kColorFF3333;
failLabel.textAlignment = NSTextAlignmentCenter;
[self.contentView addSubview:failLabel];
failLabel.whc_LeftSpace(HGADPT(30)).whc_TopSpace(HGADPT(20)).whc_Height(HGADPT(32)).whc_Width(HGADPT(120));
failLabel.text = @"即将到期";
CAShapeLayer *maskLayer = [CAShapeLayer layer];
maskLayer.path = [UIBezierPath bezierPathWithRoundedRect:failLabel.bounds byRoundingCorners: UIRectCornerBottomRight cornerRadii: (CGSize){ 5.0f}].CGPath
failLabel.layer.masksToBounds = YES;
failLabel.layer.mask = maskLayer;