VLCCircularProgressIndicator.m 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. //
  2. // VLCCircularProgressIndicator.m
  3. // AspenProject
  4. //
  5. // Created by Felix Paul Kühne on 12.05.13.
  6. // Copyright (c) 2013 VideoLAN. All rights reserved.
  7. //
  8. #import "VLCCircularProgressIndicator.h"
  9. @implementation VLCCircularProgressIndicator
  10. - (void)drawRect:(CGRect)rect
  11. {
  12. self.backgroundColor = [UIColor clearColor];
  13. CGContextClearRect(UIGraphicsGetCurrentContext(), rect);
  14. CGFloat startAngle, endAngle = 0.;
  15. startAngle = M_PI * 1.5;
  16. endAngle = startAngle + (M_PI * 2);
  17. UIBezierPath* bezierPath = [UIBezierPath bezierPath];
  18. // Create our arc, with the correct angles
  19. [bezierPath addArcWithCenter:CGPointMake(rect.size.width / 2, rect.size.height / 2)
  20. radius:(rect.size.width / 2) - 6
  21. startAngle:startAngle
  22. endAngle:(endAngle - startAngle) * self.progress + startAngle
  23. clockwise:YES];
  24. // Set the display for the path, and stroke it
  25. bezierPath.lineWidth = 6.;
  26. [[UIColor grayColor] setStroke];
  27. [bezierPath stroke];
  28. }
  29. @end