iOS 绘制折线

来源:互联网 发布:java multieditor 编辑:程序博客网 时间:2024/05/23 05:09

绘制代码:

UIBezierPath * halfCirclePath = [UIBezierPath bezierPathWithArcCenter:CGPointMake(centerX, centerY) radius:[self radius] startAngle:[self radiusOfDegress:self.startValue] endAngle:[self radiusOfDegress:self.endValue] clockwise:YES];    self.path = halfCirclePath.CGPath;    self.fillColor  = [UIColor yellowColor].CGColor;    self.strokeColor = [UIColor blackColor].CGColor;    self.lineWidth = 10;    self.lineCap = kCALineCapRound;

动画代码:

    CABasicAnimation *bas = [CABasicAnimation animationWithKeyPath:@"strokeEnd"];    bas.duration = 2;    bas.fromValue = @(0);    bas.toValue = @(1);    bas.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];    [self.halfLayer addAnimation:bas forKey:nil];
0 0