滚动停止动画iOS

use*_*906 4 uiscrollview caanimation uiviewanimation ios

我的问题很简单,在我的UIVIewController上我有一个使用CAAnimation和UIViewAnimation动画的自定义UIView,我也有一个UIScrollView,当scrollView滚动动画UIView停止它的所有动画!

timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self 

selector:@selector(updateClock:) userInfo:nil repeats:YES];
hourHand.transform = CATransform3DMakeRotation (hourAngle+M_PI, 0, 0, 1);
...
Run Code Online (Sandbox Code Playgroud)

在动画视图中我使用:NSTimer,QuartzCore和UIViewAnimation.

怎么能避免这个?这是因为我使用自定义UIView?(我还是初学者)

谢谢大家!

mar*_*sei 8

您可能对此SO问题感兴趣.UIScrollView滚动事件阻止UIView动画

建议的解决方案是添加timer到当前循环.

[[NSRunLoop currentRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];
Run Code Online (Sandbox Code Playgroud)