ios动画上下晃动动画闪回解决
参考
https://blog.csdn.net/u013282174/article/details/50388546
//view晃动方法
- (void)viewWaggleEnterAnimal {
//
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@“transform.translation”];
// 动画选项设定
animation.duration = 0.8; // 动画持续时间
animation.repeatCount = HUGE; // 重复次数无限次HUGE
animation.autoreverses = YES; (重点设置为NO闪回)// 动画结束时执行逆动画
// 起始点
animation.fromValue = [NSValue valueWithCGPoint:CGPointMake(0, 0)]; // 开始时坐标
animation.toValue = [NSValue valueWithCGPoint:CGPointMake(0, 10)]; // 结束时的坐标
animation.removedOnCompletion = NO;
// 添加动画
[当前view.layer addAnimation:animation forKey:@“translation”];
}