效果图
代码,复制走直接使用
-(void)setViewThreeCorner:(UILabel *)lable
{
lable.font = [UIFont boldSystemFontOfSize:19];
lable.textAlignment = NSTextAlignmentCenter;
lable.backgroundColor = [UIColor redColor];
lable.textColor = [UIColor whiteColor];
// 设置右下角、右上角、左上角 圆角
UIBezierPath *bezierPath = [UIBezierPath bezierPathWithRoundedRect:lable.bounds
byRoundingCorners:UIRectCornerBottomRight | UIRectCornerTopRight | UIRectCornerTopLeft
cornerRadii:CGSizeMake(lable.bounds.size.height, lable.bounds.size.height)];
CAShapeLayer *layer = [[CAShapeLayer alloc] init];
layer.path = bezierPath.CGPath;
lable.layer.mask = layer;
}
网友评论