From cf6e91a44f625c86c3e05251a25f257966919e0b Mon Sep 17 00:00:00 2001 From: Tim Oliver Date: Sun, 8 Oct 2023 10:40:46 +0900 Subject: [PATCH] Standardized directly calling ivars --- TORoundedButton/TORoundedButton.m | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/TORoundedButton/TORoundedButton.m b/TORoundedButton/TORoundedButton.m index f1617f2..e03fb2d 100644 --- a/TORoundedButton/TORoundedButton.m +++ b/TORoundedButton/TORoundedButton.m @@ -284,7 +284,7 @@ - (void)_didTouchUpInside { [self sendActionsForControlEvents:UIControlEventPrimaryActionTriggered]; // Broadcast the tap event to all subscribed objects. - if (self.tappedHandler) { self.tappedHandler(); } + if (_tappedHandler) { _tappedHandler(); } [_delegate roundedButtonDidTap:self]; } @@ -309,7 +309,7 @@ - (void)_didDragInside { #pragma mark - Animation - - (void)_setBackgroundColorTappedAnimated:(BOOL)animated TOROUNDEDBUTTON_OBJC_DIRECT { - if (!self.tappedTintColor || _isTranslucent) { return; } + if (!_tappedTintColor || _isTranslucent) { return; } // Toggle the background color of the title label void (^updateTitleOpacity)(void) = ^{ @@ -319,7 +319,7 @@ - (void)_setBackgroundColorTappedAnimated:(BOOL)animated TOROUNDEDBUTTON_OBJC_DI // ----------------------------------------------------- void (^animationBlock)(void) = ^{ - self->_backgroundView.backgroundColor = self->_isTapped ? self.tappedTintColor : self.tintColor; + self->_backgroundView.backgroundColor = self->_isTapped ? self->_tappedTintColor : self.tintColor; }; void (^completionBlock)(BOOL) = ^(BOOL completed){ @@ -333,7 +333,7 @@ - (void)_setBackgroundColorTappedAnimated:(BOOL)animated TOROUNDEDBUTTON_OBJC_DI } else { _titleLabel.backgroundColor = [UIColor clearColor]; - [UIView animateWithDuration:self.tapAnimationDuration + [UIView animateWithDuration:_tapAnimationDuration delay:0.0f usingSpringWithDamping:1.0f initialSpringVelocity:0.5f @@ -345,9 +345,9 @@ - (void)_setBackgroundColorTappedAnimated:(BOOL)animated TOROUNDEDBUTTON_OBJC_DI } - (void)_setLabelAlphaTappedAnimated:(BOOL)animated TOROUNDEDBUTTON_OBJC_DIRECT { - if (self.tappedTextAlpha > 1.0f - FLT_EPSILON) { return; } + if (_tappedTextAlpha > 1.0f - FLT_EPSILON) { return; } - CGFloat alpha = _isTapped ? self.tappedTextAlpha : 1.0f; + CGFloat alpha = _isTapped ? _tappedTextAlpha : 1.0f; // Animate the alpha value of the label void (^animationBlock)(void) = ^{ @@ -366,7 +366,7 @@ - (void)_setLabelAlphaTappedAnimated:(BOOL)animated TOROUNDEDBUTTON_OBJC_DIRECT _titleLabel.backgroundColor = [UIColor clearColor]; // Animate the button alpha - [UIView animateWithDuration:self.tapAnimationDuration + [UIView animateWithDuration:_tapAnimationDuration delay:0.0f usingSpringWithDamping:1.0f initialSpringVelocity:0.5f @@ -376,9 +376,9 @@ - (void)_setLabelAlphaTappedAnimated:(BOOL)animated TOROUNDEDBUTTON_OBJC_DIRECT } - (void)_setButtonScaledTappedAnimated:(BOOL)animated TOROUNDEDBUTTON_OBJC_DIRECT { - if (self.tappedButtonScale < FLT_EPSILON) { return; } + if (_tappedButtonScale < FLT_EPSILON) { return; } - CGFloat scale = _isTapped ? self.tappedButtonScale : 1.0f; + CGFloat scale = _isTapped ? _tappedButtonScale : 1.0f; // Animate the alpha value of the label void (^animationBlock)(void) = ^{ @@ -394,7 +394,7 @@ - (void)_setButtonScaledTappedAnimated:(BOOL)animated TOROUNDEDBUTTON_OBJC_DIREC } // Animate the button alpha - [UIView animateWithDuration:self.tapAnimationDuration + [UIView animateWithDuration:_tapAnimationDuration delay:0.0f usingSpringWithDamping:1.0f initialSpringVelocity:0.5f