本文介绍了iOS UIView动画问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在UITabBarController中的页面之间切换时,我对UIView动画有问题.
I have an issue with a UIView animation when switching between pages in a UITabBarController.
UIViewControllerA中的一个视图正在播放以下动画:-
A view in UIViewControllerA is playing the following animation:-
[UIView animateWithDuration:1.0 delay:0.0 options:UIViewAnimationOptionRepeat | UIViewAnimationOptionCurveLinear | UIViewAnimationOptionBeginFromCurrentState animations:^{
CGAffineTransform transform = CGAffineTransformMakeRotation(M_PI);
self.animationImageView.transform = transform;
} completion:NULL];
动画是一个自定义加载轮,在加载一首歌曲时停止.
The animation is a custom loading wheel which stops when a song has been loaded.
如果我在页面之间进行切换,即从UIViewControllerA切换到UIViewControllerB,然后在UITabController中回到A,则动画会停止.当我尝试重新启动它时,它不会再次设置动画.
If I switch between pages, i.e. from UIViewControllerA to UIViewControllerB and then back to A in a UITabController the animation stops. It does not animate again when I try to restart it.
推荐答案
答案很简单,请重置转换:
The answer is simple, reset the transform:
self.animationImageView.transform = CGAffineTransformIdentity;
这篇关于iOS UIView动画问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!