KKCutCircle.m 785 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. //
  2. // KKCutCircle.m
  3. // WWImageEdit
  4. //
  5. // Created by 邬维 on 2017/1/16.
  6. // Copyright © 2017年 kook. All rights reserved.
  7. //
  8. #import "KKCutCircle.h"
  9. @implementation KKCutCircle
  10. - (id)initWithFrame:(CGRect)frame
  11. {
  12. self = [super initWithFrame:frame];
  13. if (self) {
  14. self.backgroundColor = [UIColor clearColor];
  15. }
  16. return self;
  17. }
  18. - (void)drawRect:(CGRect)rect
  19. {
  20. CGContextRef context = UIGraphicsGetCurrentContext();
  21. CGRect rct = self.bounds;
  22. rct.origin.x = rct.size.width/2-rct.size.width/6;
  23. rct.origin.y = rct.size.height/2-rct.size.height/6;
  24. rct.size.width /= 3;
  25. rct.size.height /= 3;
  26. CGContextSetFillColorWithColor(context, [UIColor redColor].CGColor);
  27. CGContextFillEllipseInRect(context, rct);
  28. }
  29. @end