From c770fdd9447edce3563c6306ef1bb10975d52fc6 Mon Sep 17 00:00:00 2001 From: developforapple Date: Thu, 3 Aug 2017 17:26:33 +0800 Subject: [PATCH 1/2] BugFix Bug Reappear Steps: 1. Change data source . 2. Use reloadDataAnimated:YES to update line. 3. Use screen edge pan gesture pop to previous view controller. 4. Bug appeared! The chart view will presenting previous line. --- Classes/Line/Views/JBLineChartLinesView.m | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Classes/Line/Views/JBLineChartLinesView.m b/Classes/Line/Views/JBLineChartLinesView.m index ea335d5cb..265974726 100644 --- a/Classes/Line/Views/JBLineChartLinesView.m +++ b/Classes/Line/Views/JBLineChartLinesView.m @@ -150,6 +150,9 @@ - (void)drawRect:(CGRect)rect if (self.animated) { [shapeLineLayer addAnimation:[self basicPathAnimationFromBezierPath:shapeLineLayer.currentPath toBezierPath:linePath] forKey:@"shapeLayerPathAnimation"]; + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(kJBLineChartLinesViewReloadDataAnimationDuration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + shapeLineLayer.path = linePath.CGPath; + }); } else { @@ -577,7 +580,7 @@ - (CABasicAnimation *)basicPathAnimationFromBezierPath:(UIBezierPath *)fromBezie #pragma GCC diagnostic pop basicPathAnimation.duration = kJBLineChartLinesViewReloadDataAnimationDuration; basicPathAnimation.timingFunction = [CAMediaTimingFunction functionWithName:@"easeInEaseOut"]; - basicPathAnimation.fillMode = kCAFillModeBoth; + basicPathAnimation.fillMode = kCAFillModeForwards; basicPathAnimation.removedOnCompletion = NO; return basicPathAnimation; } From d2de9478745d9d4df157f72b3c09f0d3f107984d Mon Sep 17 00:00:00 2001 From: developforapple Date: Thu, 3 Aug 2017 17:30:58 +0800 Subject: [PATCH 2/2] BugFix Same --- Classes/Line/Views/JBLineChartLinesView.m | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Classes/Line/Views/JBLineChartLinesView.m b/Classes/Line/Views/JBLineChartLinesView.m index 265974726..cbf268e3e 100644 --- a/Classes/Line/Views/JBLineChartLinesView.m +++ b/Classes/Line/Views/JBLineChartLinesView.m @@ -179,6 +179,9 @@ - (void)drawRect:(CGRect)rect if (self.animated) { [gradientLineLayer.mask addAnimation:[self basicPathAnimationFromBezierPath:gradientLineLayer.currentPath toBezierPath:linePath] forKey:@"gradientLayerMaskAnimation"]; + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(kJBLineChartLinesViewReloadDataAnimationDuration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + [(JBShapeLineLayer *)gradientLineLayer.mask setPath:linePath.CGPath]; + }); } else {