Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scrolling stops animations iOS

My problem is quite simple, on my UIVIewController i have a custom UIView which is animated using CAAnimation and UIViewAnimation, i also have a UIScrollView, when the scrollView is scrolling the animated UIView stop all its animations !

timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self 

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

In the Animated View i use : NSTimer, QuartzCore, and UIViewAnimation.

How can avoid this ? It is because i use a custom UIView ? (I'm still a beginner)

Thanks for all !

like image 602
user2206906 Avatar asked Feb 16 '23 15:02

user2206906


1 Answers

You may be interested in this SO question. UIScrollView scroll event blocks UIView animation

The proposed solution is to add the timer to the current loop.

[[NSRunLoop currentRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];
like image 121
marsei Avatar answered Mar 05 '23 18:03

marsei