I’m trying to make an animation where the text gets moved to the bottom as it fades out, at the same time it reappears at in the same location as before and does the same animation. here my code:
for (int i=0; i<10; i++)
{
[UIView animateWithDuration:0.5
delay:0.2f
options:UIViewAnimationCurveEaseInOut
animations:^{
productTextLabel.center = CGPointMake(381, 410);
productTextLabel.alpha = 0.0;
productTextLabel.center = CGPointMake(381, 340);
productTextLabel.alpha = 1;
}
completion:^(BOOL fin) {
}];
}
my problem is I am trying to make this animation happen more than one time. I am using a for loop but it only does it once.
You can use the options UIViewAnimationOptionRepeat and UIViewAnimationOptionAutoReverse in the animationWithDuration: method to repeat and reverse the animation automatically.
The whole method will become:
To cancel the animation you can call
Note: You should import QuartzCore to be able to call the removeAllAnimations function.