From 7b02207537d35bfa1714bf8beafc921f717d100a Mon Sep 17 00:00:00 2001 From: 单军华 Date: Wed, 11 Jul 2018 10:47:42 +0800 Subject: [PATCH] 首次上传 --- screendisplay/screendisplay/Classes/ThirdClass/JHChart/JHPieItemsView.m | 68 ++++++++++++++++++++++++++++++++++ 1 files changed, 68 insertions(+), 0 deletions(-) diff --git a/screendisplay/screendisplay/Classes/ThirdClass/JHChart/JHPieItemsView.m b/screendisplay/screendisplay/Classes/ThirdClass/JHChart/JHPieItemsView.m new file mode 100755 index 0000000..dda3fc3 --- /dev/null +++ b/screendisplay/screendisplay/Classes/ThirdClass/JHChart/JHPieItemsView.m @@ -0,0 +1,68 @@ +// +// JHPieItemsView.m +// JHCALayer +// +// Created by cjatech-������ on 16/4/28. +// Copyright �� 2016��� JH. All rights reserved. +// + +#import "JHPieItemsView.h" +@interface JHPieItemsView () + +@property (nonatomic,assign) CGFloat beginAngle; +@property (nonatomic,assign) CGFloat endAngle; +@property (nonatomic,strong) UIColor * fillColor; +@property (nonatomic,strong) CAShapeLayer * shapeLayer; +@end +@implementation JHPieItemsView +-(JHPieItemsView *)initWithFrame:(CGRect)frame andBeginAngle:(CGFloat)beginAngle andEndAngle:(CGFloat)endAngle andFillColor:(UIColor *)fillColor{ + + if (self = [super initWithFrame:frame]) { + + + _beginAngle = beginAngle; + _endAngle = endAngle; + _fillColor = fillColor; + + [self configBaseLayer]; + + } + + return self; + + + +} + +- (void)configBaseLayer{ + _shapeLayer = [CAShapeLayer layer]; + + UIBezierPath *path = [UIBezierPath bezierPath]; + + [path addArcWithCenter:CGPointMake(self.frame.size.width/2, self.frame.size.height/2) radius:self.frame.size.width/2 startAngle:_beginAngle endAngle:_endAngle clockwise:YES]; + + _shapeLayer.path = path.CGPath; + _shapeLayer.lineWidth = self.frame.size.width; + _shapeLayer.strokeColor = _fillColor.CGColor; + _shapeLayer.fillColor = [UIColor clearColor].CGColor; + + + [self.layer addSublayer:_shapeLayer]; + + CABasicAnimation *basic = [CABasicAnimation animationWithKeyPath:@"strokeEnd"]; + basic.duration = 1.1; + basic.fromValue = @(0.1f); + basic.toValue = @(1.0f); + [_shapeLayer addAnimation:basic forKey:@"basic"]; + + +} + + + +-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{ + NSLog(@"touch%ld",self.tag); + +} + +@end -- Gitblit v1.8.0