VLCLinearProgressIndicator.m 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. // Refer to the COPYING file of the official project for license.
  9. //
  10. #import "VLCLinearProgressIndicator.h"
  11. @implementation VLCLinearProgressIndicator
  12. - (void)drawRect:(CGRect)rect
  13. {
  14. self.backgroundColor = [UIColor clearColor];
  15. CGContextClearRect(UIGraphicsGetCurrentContext(), rect);
  16. UIColor *drawingColor = [UIColor colorWithRed:.792 green:.408 blue:.0 alpha:.9];
  17. UIBezierPath* bezierPath = [UIBezierPath bezierPath];
  18. float progress_width = self.progress * rect.size.width;
  19. [bezierPath moveToPoint:CGPointMake(progress_width - rect.size.height + 3., 2.)];
  20. // Create our triangle
  21. [bezierPath addLineToPoint:CGPointMake(progress_width - (rect.size.height/2), rect.size.height - 5.)];
  22. [bezierPath addLineToPoint:CGPointMake(progress_width - 3., 2.)];
  23. [bezierPath closePath];
  24. // Set the display for the path, and stroke it
  25. bezierPath.lineWidth = 6.;
  26. [drawingColor setStroke];
  27. [bezierPath stroke];
  28. [drawingColor setFill];
  29. [bezierPath fill];
  30. }
  31. @end