From a42f05da0e71287a21f69d6888ffdb666f7a398d Mon Sep 17 00:00:00 2001 From: Looping Date: Mon, 8 Dec 2014 21:00:53 +0800 Subject: [PATCH] Using POPBasicAnimation --- RCPageControl/RCPageControl.m | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/RCPageControl/RCPageControl.m b/RCPageControl/RCPageControl.m index c148309..41b4661 100644 --- a/RCPageControl/RCPageControl.m +++ b/RCPageControl/RCPageControl.m @@ -48,6 +48,7 @@ #define RCDefaultIndicatorScaleAnimationKey @"RCPageControlIndicatorScaleAnimation" #define RCDefaultIndicatorColorAnimationKey @"RCPageControlIndicatorColorAnimation" +#define RCDefaultIndicatorIndexLabelAlphaAnimationKey @"RCDefaultIndicatorIndexLabelAlphaAnimationKey" #define IsFloatZero(A) fabsf(A) < FLT_EPSILON #define IsFloatEqualToFloat(A, B) IsFloatZero((A) - (B)) @@ -376,12 +377,12 @@ [_indicatorIndexLabel setCenter:[self _dotAtIndex:toPage].center]; [_indicatorIndexLabel setText:[NSString stringWithFormat:@"%@", @(toPage + 1)]]; - - [_indicatorIndexLabel setAlpha:.3f]; - [UIView animateWithDuration:_disableAnimation ? 0 : _animationDuration animations:^{ - [_indicatorIndexLabel setAlpha:1.f]; - }]; + POPBasicAnimation *alphaAnimation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewAlpha]; + alphaAnimation.fromValue = @(.3f); + alphaAnimation.toValue = @(1.f); + alphaAnimation.duration = _disableAnimation ? 0 : _animationDuration; + [_indicatorIndexLabel pop_addAnimation:alphaAnimation forKey:RCDefaultIndicatorIndexLabelAlphaAnimationKey]; } } }