#pragma mark - UI布局
//#pragma mark - 由时间画圆
//- (void)drawGreenCirWithBegainTime:(float)t1 andEndTime:(float)t2{
// //调整大小
// NSInteger jian = kframe.size.width/3.5;
// CGRect cirFrame = kframe;
// cirFrame.size.height -= jian;
// cirFrame.size.width -= jian;
// cirFrame.origin.x += jian/2;
// cirFrame.origin.y += jian/2;
// // 在内存栈中创建一个画布对象 Stack Top
// UIGraphicsBeginImageContext(cirFrame.size);
// // 得到刚刚创建的画布对象(取得stack top画布)
// _context = UIGraphicsGetCurrentContext();
// //画笔线的颜色
// CGContextSetRGBStrokeColor(_context,0,1,0,1.0);
// //线的宽度
// CGContextSetLineWidth(_context, 1.0);
// //void CGContextAddArc(CGContextRef c,CGFloat x, CGFloat y,CGFloat radius,CGFloat startAngle,CGFloat endAngle, int clockwise)1弧度=180°/π(≈57.3°)度=弧度×180°/π 360°=360×π/180=2π 弧度
// // x,y为圆点坐标,radius半径,startAngle为开始的弧度,endAngle为结束的弧度,clockwise 0为顺时针,1为逆时针。
// CGContextAddArc(_context, cirFrame.size.height/2, cirFrame.size.height/2, cirFrame.size.height/2, t1, t2, 0); //添加一个圆
// //绘制路径
// CGContextDrawPath(_context, kCGPathStroke);
// //gao
// UIImage *img2 = UIGraphicsGetImageFromCurrentImageContext();
// UIGraphicsEndImageContext();
// _cxtImgView = [[UIImageView alloc ] initWithImage:img2];
// _cxtImgView.backgroundColor = [UIColor clearColor];
// //CGRect imageViewFrame = cirFrame;
// //imageViewFrame.origin.x = 0;
// //imageViewFrame.origin.y = 0;
// //_cxtImgView.frame = imageViewFrame;
// //_cxtImgView.center = _wheelClockView.center;
// _cxtImgView.frame = cirFrame;
// _tag += 1;
// _cxtImgView.tag = _tag;
// [self.view addSubview:_cxtImgView];
// //[_wheelClockView addSubview:_cxtImgView];
//}
#pragma mark - 由时间画圆
- (void)drawGreenCirWithBegainTime:(NSString *)t1Str andEndTime:(NSString *)t2Str{
NSDateFormatter * dateFormatter = [[NSDateFormatteralloc] init];
dateFormatter.dateFormat =@"yyyy-MM-dd HH:mm:ss";
NSDate *t1Date = [dateFormatter dateFromString:t1Str];
NSDate *t2Date = [dateFormatter dateFromString:t2Str];
NSDate *zeroDate = [dateFormatter dateFromString:[NSString stringWithFormat:@"%@ 00:00:00",_pickDate]];
NSLog(@"gao - %@",[dateFormatterstringFromDate:zeroDate]);
double interval1 = [t1Date timeIntervalSinceDate:zeroDate];
double interval2 = [t2Date timeIntervalSinceDate:zeroDate];
NSLog(@"gao - %f--%f",interval1, interval2);
//表的零点比圆的零点多出pi/2
double t1 = interval1/(24.0*60.0*60.0)*2*PI-PI/2;
double t2 = interval2/(24.0*60.0*60.0)*2*PI-PI/2;
NSLog(@"gao - %f", t1);
NSLog(@"gao - %f", t2);
//调整大小
NSInteger jian =kframe.size.width/3.5;
CGRect cirFrame = kframe;
cirFrame.size.height -= jian;
cirFrame.size.width -= jian;
cirFrame.origin.x += jian/2;
cirFrame.origin.y += jian/2;
CGContextSetRGBFillColor (_context, 1, 0,0, 1.0);//设置填充颜色
//填充圆,无边框
CGContextAddArc(_context,150, 30, 30, 0, 2*PI,0); //添加一个圆
CGContextDrawPath(_context,kCGPathFill);//绘制填充
// 在内存栈中创建一个画布对象 Stack Top
UIGraphicsBeginImageContext(cirFrame.size);
// UIGraphicsEndImageContext();
// 得到刚刚创建的画布对象(取得stack top 画布)
_context =UIGraphicsGetCurrentContext();
//画笔线的颜色
CGContextSetRGBStrokeColor(_context,0,1,0,1.0);
//线的宽度
CGContextSetLineWidth(_context,1.0);
//void CGContextAddArc(CGContextRef c,CGFloat x, CGFloat y,CGFloat radius,CGFloat startAngle,CGFloat endAngle, int clockwise)1弧度=180°/π(≈57.3°)度=弧度×180°/π 360°=360×π/180=2π 弧度
// x,y为圆点坐标,radius半径,startAngle为开始的弧度,endAngle为结束的弧度,clockwise 0为顺时针,1为逆时针。
CGContextAddArc(_context, cirFrame.size.height/2, cirFrame.size.height/2, cirFrame.size.height/2, t1, t2,0); //添加一个圆
//绘制路径
CGContextDrawPath(_context,kCGPathStroke);
//CGContextClearRect(_context, cirFrame);
//gao
UIImage *img2 =UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
_cxtImgView = [[UIImageViewalloc ] initWithImage:img2];
_cxtImgView.backgroundColor = [UIColorclearColor];
//CGRect imageViewFrame = cirFrame;
//imageViewFrame.origin.x = 0;
//imageViewFrame.origin.y = 0;
//_cxtImgView.frame = imageViewFrame;
//_cxtImgView.center = _wheelClockView.center;
_cxtImgView.frame = cirFrame;
_tag += 1;
_cxtImgView.tag =_tag;
[self.viewaddSubview:_cxtImgView];
//[self clear];
//[_paintView addSubview:_cxtImgView];
}