VLCLinearProgressIndicator.m 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. //
  2. // VLCLinearProgressIndicator.m
  3. // AspenProject
  4. //
  5. // Created by Felix Paul Kühne on 13.05.13.
  6. // Copyright (c) 2013 VideoLAN. All rights reserved.
  7. //
  8. #import "VLCLinearProgressIndicator.h"
  9. @implementation VLCLinearProgressIndicator
  10. - (void)drawRect:(CGRect)rect
  11. {
  12. self.backgroundColor = [UIColor clearColor];
  13. CGContextClearRect(UIGraphicsGetCurrentContext(), rect);
  14. UIColor *drawingColor = [UIColor colorWithWhite:.67 alpha:.9];
  15. UIBezierPath* bezierPath = [UIBezierPath bezierPath];
  16. float progress_width = self.progress * rect.size.width;
  17. [bezierPath moveToPoint:CGPointMake(progress_width - rect.size.height + 3., 2.)];
  18. // Create our triangle
  19. [bezierPath addLineToPoint:CGPointMake(progress_width - (rect.size.height/2), rect.size.height - 5.)];
  20. [bezierPath addLineToPoint:CGPointMake(progress_width - 3., 2.)];
  21. [bezierPath closePath];
  22. // Set the display for the path, and stroke it
  23. bezierPath.lineWidth = 6.;
  24. [drawingColor setStroke];
  25. [bezierPath stroke];
  26. [drawingColor setFill];
  27. [bezierPath fill];
  28. }
  29. @end