
CABasicAnimation *hover = [CABasicAnimation animationWithKeyPath:@"position"];hover.additive = YES; // fromValue and tovalue will be relative instead of absolute valueshover.fromValue = [NSValue valueWithCGPoint:CGPointZero];hover.tovalue = [NSValue valueWithCGPoint:CGPointMake(0.0,-10.0)]; // y increases downwards on iOShover.autoreverses = YES; // Animate back to normal afterwardshover.duration = 0.2; // The duration for one part of the animation (0.2 up and 0.2 down)hover.repeatCount = INFINITY; // The number of times the animation should repeat[myVIEw.layer addAnimation:hover forKey:@"myHoverAnimation"];
由于这是使用Core Animation,您需要添加QuartzCore.framework和#import< QuartzCore / QuartzCore.h>进入你的代码.
总结以上是内存溢出为你收集整理的ios – 在UIImageView中向上和向下动画UIImage(就像它的悬停)循环全部内容,希望文章能够帮你解决ios – 在UIImageView中向上和向下动画UIImage(就像它的悬停)循环所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)