[英]Rounded Corner of two Label in ios
我有两个标签左右提及。 现在我想从左标签的左边和右标签的右边弄圆角
我已经试过了:
cell.rightLabel.layer.cornerRadius = UIRectCornerBottomLeft | UIRectCornerTopLeft;
(此代码也无法正常工作,所有边框均四舍五入..)
cell.rightLabel.layer.cornerRadius = 8;
cell.leftlabel.layer.cornerRadius = UIRectCornerBottomRight | UIRectCornerTopRight;
cell.leftlabel.layer.cornerRadius = 8;
将属性clipsToBounds
设置为YES或使用MasksToBounds
为YES
cell.rightLabel.clipsToBounds = YES;
cell.leftlabel.clipsToBounds = YES;
尝试这个
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:cell.rightLabel.bounds byRoundingCorners:(UIRectCornerTopLeft | UIRectCornerBottomLeft ) cornerRadii:CGSizeMake(10.0, 10.0)];
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
maskLayer.frame = cell.rightLabel.bounds;
maskLayer.path = maskPath.CGPath;
cell.rightLabel.layer.mask = maskLayer;
尝试这个 :
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:self.label.bounds byRoundingCorners:(UIRectCornerTopLeft | UIRectCornerBottomLeft ) cornerRadii:CGSizeMake(10.0, 10.0)];
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
maskLayer.frame = self.view.bounds;
maskLayer.path = maskPath.CGPath;
self.label.layer.mask = maskLayer;
我希望它的工作.....
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.