No Description

QBVideoIconView.m 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. //
  2. // QBVideoIconView.m
  3. // QBImagePicker
  4. //
  5. // Created by Katsuma Tanaka on 2015/04/04.
  6. // Copyright (c) 2015 Katsuma Tanaka. All rights reserved.
  7. //
  8. #import "QBVideoIconView.h"
  9. @implementation QBVideoIconView
  10. - (void)awakeFromNib
  11. {
  12. [super awakeFromNib];
  13. // Set default values
  14. self.iconColor = [UIColor whiteColor];
  15. }
  16. - (void)drawRect:(CGRect)rect
  17. {
  18. [self.iconColor setFill];
  19. // Draw triangle
  20. UIBezierPath *trianglePath = [UIBezierPath bezierPath];
  21. [trianglePath moveToPoint:CGPointMake(CGRectGetMaxX(self.bounds), CGRectGetMinY(self.bounds))];
  22. [trianglePath addLineToPoint:CGPointMake(CGRectGetMaxX(self.bounds), CGRectGetMaxY(self.bounds))];
  23. [trianglePath addLineToPoint:CGPointMake(CGRectGetMaxX(self.bounds) - CGRectGetMidY(self.bounds), CGRectGetMidY(self.bounds))];
  24. [trianglePath closePath];
  25. [trianglePath fill];
  26. // Draw rounded square
  27. UIBezierPath *squarePath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(CGRectGetMinX(self.bounds), CGRectGetMinY(self.bounds), CGRectGetWidth(self.bounds) - CGRectGetMidY(self.bounds) - 1.0, CGRectGetHeight(self.bounds)) cornerRadius:2.0];
  28. [squarePath fill];
  29. }
  30. @end