Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fixed a bug that cancelled the animation timer and made the pie chart disappear whenever the user clicks on the animating chart. #20

Merged
merged 1 commit into from

2 participants

@miketsprague

Run the animation timer on the main thread. We want to allow the user
to interact with the UI while this timer is running. If we run it on
this thread, the timer will be halted while the user is touching the
screen (that's why the chart was disappearing in our collection view).

Michael Sprague Run the animation timer on the main thread to fix interaction bug
Run the animation timer on the main thread.  We want to allow the user
to interact with the UI while this timer is running.  If we run it on
this thread, the timer will be halted while the user is touching the
screen (that's why the chart was disappearing in our collection view).
91a50a5
@xyfeng xyfeng merged commit bb45cb2 into xyfeng:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 8, 2013
  1. Run the animation timer on the main thread to fix interaction bug

    Michael Sprague authored
    Run the animation timer on the main thread.  We want to allow the user
    to interact with the UI while this timer is running.  If we run it on
    this thread, the timer will be halted while the user is touching the
    screen (that's why the chart was disappearing in our collection view).
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 1 deletion.
  1. +5 −1 XYPieChart/XYPieChart.m
View
6 XYPieChart/XYPieChart.m
@@ -459,7 +459,11 @@ - (void)animationDidStart:(CAAnimation *)anim
{
if (_animationTimer == nil) {
static float timeInterval = 1.0/60.0;
- _animationTimer= [NSTimer scheduledTimerWithTimeInterval:timeInterval target:self selector:@selector(updateTimerFired:) userInfo:nil repeats:YES];
+ // Run the animation timer on the main thread.
+ // We want to allow the user to interact with the UI while this timer is running.
+ // If we run it on this thread, the timer will be halted while the user is touching the screen (that's why the chart was disappearing in our collection view).
+ _animationTimer= [NSTimer timerWithTimeInterval:timeInterval target:self selector:@selector(updateTimerFired:) userInfo:nil repeats:YES];
+ [[NSRunLoop mainRunLoop] addTimer:_animationTimer forMode:NSRunLoopCommonModes];
}
[_animations addObject:anim];
Something went wrong with that request. Please try again.