要实现某个图片上下浮动的动画效果很只需要三步:
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-字唐名僧
如果觉得《iOS 图标上下浮动的动画效果》对你有帮助,请点赞、收藏,并留下你的观点哦!