如何进行侧面cornor半径的进展

时间:2017-01-25 05:33:50

标签: ios objective-c progress-bar uiprogressview

如何设置进度视图的一侧角半径。

请查找结果progressView的附件。 YLProgressView

下面是我的ProgressView代码。

cell.categoryImageView.backgroundColor = [categoryColorArray objectAtIndex:indexPath.row];
cell.categoryImageView.image = [UIImage imageNamed:[categoryImageArray objectAtIndex:indexPath.row]];

cell.progressView.indicatorTextDisplayMode = MHProgressBarIndicatorTextDisplayModeProgress;
cell.progressView.type                     = MHProgressBarTypeFlat;
cell.progressView.behavior                 = MHProgressBarBehaviorIndeterminate;
cell.progressView.stripesOrientation       = MHProgressBarStripesOrientationVertical;

UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:cell.progressView.bounds byRoundingCorners:(UIRectCornerTopRight |  UIRectCornerBottomRight) cornerRadii:CGSizeMake(10.0, 10.0)];

CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
maskLayer.frame =   cell.progressView.bounds;
maskLayer.path  = maskPath.CGPath;
cell.progressView.layer.mask = maskLayer;

enter image description here

非常感谢您的反馈! 提前谢谢。

1 个答案:

答案 0 :(得分:0)

尝试使用此进度视图的角半径:

UIBezierPath *progressViewPath = [UIBezierPath bezierPathWithRoundedRect:cell.progressView.bounds byRoundingCorners:(UIRectCornerTopRight | UIRectCornerBottomRight) cornerRadii:CGSizeMake(20, 0)];
CAShapeLayer *progressViewLayer = [[CAShapeLayer alloc] init];
progressViewLayer.frame = self.view.bounds;
progressViewLayer.path  = progressViewPath.CGPath;
cell.progressView.layer.mask = progressViewLayer;