From db3e670c259d5e6c3650967c9bf4b69ba93144f9 Mon Sep 17 00:00:00 2001 From: Mark Allen Date: Tue, 2 Jul 2013 11:52:51 -0400 Subject: [PATCH 1/3] Fix for rounding issue when calculating step angle. This caused a rendering gap where in some cases the last fin to be drawn would not touch the first fin (this is visible in the demo screenshot). --- HZActivityIndicator/HZActivityIndicatorView.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HZActivityIndicator/HZActivityIndicatorView.m b/HZActivityIndicator/HZActivityIndicatorView.m index d5b610f..921542a 100644 --- a/HZActivityIndicator/HZActivityIndicatorView.m +++ b/HZActivityIndicator/HZActivityIndicatorView.m @@ -185,7 +185,7 @@ - (void)setIndicatorRadius:(NSUInteger)indicatorRadius - (void)setSteps:(NSUInteger)steps { - _anglePerStep = (360/steps) * M_PI / 180; + _anglePerStep = (360. / (CGFloat)steps) * M_PI / 180.; _steps = steps; [self setNeedsDisplay]; } From bfd27749900795c4a5f135a93e0c8f4f2ca69c1f Mon Sep 17 00:00:00 2001 From: Mark Allen Date: Wed, 14 Aug 2013 11:05:03 -0400 Subject: [PATCH 2/3] Current step calculation doesn't work correctly on device (simulator is OK) when choosing color for fin --- HZActivityIndicator/HZActivityIndicatorView.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/HZActivityIndicator/HZActivityIndicatorView.m b/HZActivityIndicator/HZActivityIndicatorView.m index 921542a..5501b32 100644 --- a/HZActivityIndicator/HZActivityIndicatorView.m +++ b/HZActivityIndicator/HZActivityIndicatorView.m @@ -227,10 +227,10 @@ - (void)drawRect:(CGRect)rect UIBezierPath *bezierPath = [self finPathWithRect:finRect]; CGPathRef bezierPathRef = CGPathCreateCopy([bezierPath CGPath]); - - for (int i = 0; i < _steps; i++) + + for (int i = 0; i < _steps; i++) { - [[self _colorForStep:_currStep+i*_direction] set]; + [[self _colorForStep:i*_direction] set]; CGContextBeginPath(context); CGContextAddPath(context, bezierPathRef); From ca47313070cb8f50005beaa5032db03147d5633c Mon Sep 17 00:00:00 2001 From: Mark Allen Date: Tue, 1 Oct 2013 15:06:23 -0400 Subject: [PATCH 3/3] Revert "Current step calculation doesn't work correctly on device (simulator is OK) when choosing color for fin" This reverts commit bfd27749900795c4a5f135a93e0c8f4f2ca69c1f. --- HZActivityIndicator/HZActivityIndicatorView.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/HZActivityIndicator/HZActivityIndicatorView.m b/HZActivityIndicator/HZActivityIndicatorView.m index 5501b32..921542a 100644 --- a/HZActivityIndicator/HZActivityIndicatorView.m +++ b/HZActivityIndicator/HZActivityIndicatorView.m @@ -227,10 +227,10 @@ - (void)drawRect:(CGRect)rect UIBezierPath *bezierPath = [self finPathWithRect:finRect]; CGPathRef bezierPathRef = CGPathCreateCopy([bezierPath CGPath]); - - for (int i = 0; i < _steps; i++) + + for (int i = 0; i < _steps; i++) { - [[self _colorForStep:i*_direction] set]; + [[self _colorForStep:_currStep+i*_direction] set]; CGContextBeginPath(context); CGContextAddPath(context, bezierPathRef);