i am animating a button using core animation now on a certain condition i want to stop that animation how do i stop the animation?
here is the method to animate the button
-(void)animateButton:(UIButton *)btnName
{
CABasicAnimation *pulseAnimation = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
pulseAnimation.duration = .5;
pulseAnimation.toValue = [NSNumber numberWithFloat:1.1];
pulseAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
pulseAnimation.autoreverses = YES;
pulseAnimation.repeatCount = FLT_MAX;
[btnName.layer addAnimation:pulseAnimation forKey:nil];
}