UILabel圆化指定角

2017-09-01  本文已影响0人  Felix的笔头

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];

上一篇 下一篇

猜你喜欢

热点阅读