猎豆优选

QBSlomoIconView.m 782B

12345678910111213141516171819202122232425262728293031323334353637
  1. //
  2. // QBSlomoIconView.m
  3. // QBImagePicker
  4. //
  5. // Created by Julien Chaumond on 22/04/2015.
  6. // Copyright (c) 2015 Katsuma Tanaka. All rights reserved.
  7. //
  8. #import "QBSlomoIconView.h"
  9. @implementation QBSlomoIconView
  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 setStroke];
  19. CGFloat width = 2.2;
  20. CGRect insetRect = CGRectInset(rect, width / 2, width / 2);
  21. // Draw dashed circle
  22. UIBezierPath* circlePath = [UIBezierPath bezierPathWithOvalInRect:insetRect];
  23. circlePath.lineWidth = width;
  24. CGFloat ovalPattern[] = {0.75, 0.75};
  25. [circlePath setLineDash:ovalPattern count:2 phase:0];
  26. [circlePath stroke];
  27. }
  28. @end