A circular progress bar is achieved through the busel curve and the strokeStart and strokeEnd attributes of CAShapeLayer.
# Import <UIKit/UIKit. h> @ interface CircleProgressView: UIView/** start value (0-1) */@ property (nonatomic, assign) CGFloat fstartValue; /** Border Width */@ property (nonatomic, assign) CGFloat flineWidth;/** line color */@ property (nonatomic, strong) UIColor * lineColor; /** variable value */@ property (nonatomic, assign) CGFloat fvalue; @ end # import "CircleProgressView. h "@ interface CircleProgressView () {Pipeline * _ shapeLayer;} @ end @ implementation CircleProgressView @ synthesize fstartValue = _ fstartValue; @ synthesize flineWidth = _ flineWidth; @ synthesize lineColor = _ lineColor; @ synthesize fvalue = _ fvalue;-(instancetype) initWithFrame :( CGRect) frame {self = [super initWithFrame: frame]; if (self) {/** create a layer with shapes */_ shapeLayer = [CAShapeLayer layer]; _ shapeLayer. frame = self. bounds; _ shapeLayer. strokeEnd = 0.f;/* Create a busel curve */UIBezierPath * path = [UIBezierPath bezierPathWithOvalInRect: self. bounds];/** associate a layer with a non-Sel curve using a path */_ shapeLayer. path = path. CGPath;/** set the fill color, width, and border color of the layer */_ shapeLayer. fillColor = [UIColor clearColor]. CGColor; _ shapeLayer. lineWidth = 1.0f; _ shapeLayer. strokeColor = [UIColor redColor]. CGColor; [self. layer addSublayer: _ shapeLayer];} return self ;} /*** @ brief override the setter method of fstartValue * @ param fstartValue set the starting value of the circular strokeStart * @ since */-(void) setFstartValue :( CGFloat) fstartValue {_ fstartValue = fstartValue; _ shapeLayer. strokeStart = fstartValue;}-(CGFloat) fstartValue {return _ fstartValue ;} /*** @ brief override flineWidth setter Method * @ param flineWidth set the width of the circular border * @ since */-(void) setFlineWidth :( CGFloat) flineWidth {_ flineWidth = flineWidth; _ shapeLayer. lineWidth = flineWidth;}/*** @ brief override lineColor's setter Method * @ param lineColor sets the circular border color * @ since */-(void) setLineColor :( UIColor *) lineColor {_ lineColor = lineColor; _ shapeLayer. strokeColor = lineColor. CGColor;}-(UIColor *) lineColor {return _ lineColor ;} /*** @ brief override fvalue setter Method * @ param lineColor set the strokeEnd value of the circle * @ since */-(void) setFvalue :( CGFloat) fvalue {_ fvalue = fvalue; _ shapeLayer. strokeEnd = fvalue;}-(CGFloat) fvalue {return _ fvalue;} @ end # import "ViewController. h "# import" CircleProgressView. h "@ interface ViewController () {CircleProgressView * progress;} @ end @ implementation ViewController-(void) viewDidLoad {[super viewDidLoad]; progress = [[CircleProgressView alloc] initWithFrame: CGRectMake (0, 0,200,200)]; progress. center = self. view. center; progress. lineColor = [UIColor redColor]; progress. flineWidth = 1.0f; progress. fstartValue = 0; [self. view addSubview: progress]; [NSTimer scheduledTimerWithTimeInterval: 1.0f target: self selector: @ selector (circleAnimation) userInfo: nil repeats: YES] ;}( void) circleAnimation {progress. fvalue = arc4random () %100/100. f;}-(void) didReceiveMemoryWarning {[super didreceivemorywarning];} @ end