开发者

CABasicAnimation Repeat itself

开发者 https://www.devze.com 2023-01-13 15:16 出处:网络
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

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 ani开发者_如何学Gomating 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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号