Parad0x13
Parad0x13

Reputation: 2065

CABasicAnimation Repeat itself

I have a CABasicAnimation that I perform on multiple layers and all it does is move the UIImageView up 10 pixels and then back down. I want this to continue ad infinitum. When the animation finishes I can't figure out how to get it to do it again! I understand theres a animationDidStop method but that doesn't solve my problem because I can't detect the layer that stopped moving.

How would I achieve animating a UIImageView in a constant up and down animation? I tried with [UIImageView beginAnimations] etc... but there isn't a comulative value for those type of animations

Upvotes: 2

Views: 4163

Answers (1)

bstahlhood
bstahlhood

Reputation: 2006

myBasicAnimation.removedOnCompleted = NO;
myBasicAnimation.fillMode = kCAFillModeForwards;
myBasicAnimation.cumulative = YES;

Then set the rest of the properties the way you normal would to create an animation. Set your repeatCount, fromValue, and toValue.

Upvotes: 2

Related Questions