Bez popisu

KXMainWaitBGView.m 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. //
  2. // KXMainWaitBGView.m
  3. // QBCS
  4. //
  5. // Created by qianbodong on 2017/7/31.
  6. // Copyright © 2017年 kuxuan. All rights reserved.
  7. //
  8. #import "KXMainWaitBGView.h"
  9. @interface KXMainWaitBGView ()
  10. @property (nonatomic,assign) CGFloat h1;
  11. @property (nonatomic,assign) CGFloat h2;
  12. @end
  13. @implementation KXMainWaitBGView
  14. - (id)initWithFrame:(CGRect)frame height1:(CGFloat) h1 height2:(CGFloat) h2
  15. {
  16. self = [super initWithFrame:frame];
  17. if (self) {
  18. _h1=h1;
  19. _h2=h2;
  20. }
  21. return self;
  22. }
  23. - (void)drawRect:(CGRect)rect
  24. {
  25. [super drawRect:rect];
  26. // CGRect frame = CGRectMake(50, 100, 12*, 100);
  27. // /*画填充圆
  28. // */
  29. CGContextRef context = UIGraphicsGetCurrentContext();
  30. [[UIColor redColor] set];
  31. // CGContextFillRect(context, rect);
  32. CGContextAddArc(context, 20*SCREEN_MUTI, 52*SCREEN_MUTI+_h1/2, 6*SCREEN_MUTI, 0, 2*M_PI, 0); //添加一个圆
  33. CGContextDrawPath(context, kCGPathFill);//绘制填充
  34. //填充圆,无边框
  35. // CGContextSetRGBStrokeColor(context, 255/255.0, 96/255.0, 0/255.0, 1);
  36. CGContextSetLineWidth(context, 1.0);
  37. /*边框圆
  38. */
  39. CGContextSetRGBStrokeColor(context, 255/255.0, 96/255.0, 0/255.0, 1);
  40. CGContextSetLineWidth(context, 1.0);
  41. CGContextAddArc(context, 20*SCREEN_MUTI, (52+59+10)*SCREEN_MUTI+_h1/2, 4*SCREEN_MUTI, 0, 2*M_PI, 0);
  42. CGContextDrawPath(context, kCGPathStroke);
  43. //画线
  44. CGPoint aPoints[2];//坐标点
  45. aPoints[0] =CGPointMake(20*SCREEN_MUTI, 58*SCREEN_MUTI+_h1/2);//坐标1
  46. aPoints[1] =CGPointMake(20*SCREEN_MUTI, (117)*SCREEN_MUTI+_h1/2);//坐标2
  47. //CGContextAddLines(CGContextRef c, const CGPoint points[],size_t count)
  48. //points[]坐标数组,和count大小
  49. CGContextAddLines(context, aPoints, 2);//添加线
  50. CGContextDrawPath(context, kCGPathStroke); //根据坐标绘制路径
  51. }
  52. @end