iOS UIView Animation Issue

自作多情 提交于 2019-12-04 05:39:39

问题


I have an issue with a UIView animation when switching between pages in a UITabBarController.

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.

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.


回答1:


The answer is simple, reset the transform:

self.animationImageView.transform = CGAffineTransformIdentity;


来源:https://stackoverflow.com/questions/8489638/ios-uiview-animation-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!