UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(30, 200, 200, 20)];
label.backgroundColor = COLOR_FF574E;
UIBezierPath * maskPath = [UIBezierPath bezierPathWithRoundedRect:label.bounds byRoundingCorners:UIRectCornerBottomLeft|UIRectCornerTopLeft cornerRadii:CGSizeMake(5, 5)];
CAShapeLayer * maskLayer = [[CAShapeLayer alloc]init];
maskLayer.frame = label.bounds;
maskLayer.path = maskPath.CGPath;
label.layer.mask = maskLayer;
[self.view addSubview:label];
网友评论