gpt4 book ai didi

ios - 滚动停止动画 iOS

转载 作者:可可西里 更新时间:2023-11-01 05:13:11 25 4
gpt4 key购买 nike

我的问题很简单,在我的 UIVIewController 上我有一个自定义 UIView,它使用 CAAnimation 和 UIViewAnimation 进行动画处理,我还有一个 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);
...

在我使用的动画 View 中:NSTimer、QuartzCore 和 UIViewAnimation。

如何避免这种情况?这是因为我使用自定义 UIView 吗? (我还是初学者)

谢谢大家!

最佳答案

您可能对这个 SO 问题感兴趣。 UIScrollView scroll event blocks UIView animation

建议的解决方案是将计时器添加到当前循环。

[[NSRunLoop currentRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];

关于ios - 滚动停止动画 iOS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18148135/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com