0

How to set progressview one side corner radius.

Please find the attachment the resultant progressView. YLProgressView

Below is my ProgressView code.

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

Your feedback is highly appreciated! Thanks in advance.

kiran
  • 4,285
  • 7
  • 53
  • 98

1 Answers1

0

Try this for corner radius for your progress view:

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;
amit_donga
  • 224
  • 1
  • 9