要实现某个图片上下浮动的动画效果很只需要三步:
1.把图标下拉
2.把图标上移
3.重复步骤1 2
- (void)ImageSpring { [UIView animateWithDuration:0.5 animations:^{ _imageView.frame = CGRectMake(_imageView.frame.origin.x, _imageView.frame.origin.y+10, 40, 40); }]; [UIView animateWithDuration:0.5 delay:0.5 options:UIViewAnimationOptionCurveEaseInOut animations:^{ _imageView.frame = CGRectMake(_imageView.frame.origin.x, _imageView.frame.origin.y-10, 40, 40); } completion:^(BOOL finished) { [self ImageSpring]; }];} 君凯商联网-iOS-字唐名僧