Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

animateWithDuration:delay:options:animations:completion: blocking UI when used with UIViewAnimationOptionRepeat | UIViewAnimationOptionAutoreverse

I'm running a function to pulse a play icon:

- (void)pulsePlayIcon {
    if ([self isPlaying]) {
        return;
    }

    [[self videoView] playIcon].hidden = NO;
    [[self videoView] playIcon].alpha = 1.0;

    [UIView animateWithDuration:[self playIconPulseDuration] 
                          delay:[self playIconPulseTimeInterval] 
                        options:(UIViewAnimationOptionRepeat | UIViewAnimationOptionAutoreverse) 
                     animations:^{
                         [[self videoView] playIcon].alpha = 0.8;
                     } 
                     completion:^(BOOL completed) {}];
}

This works wonderfully in iOS 5.0, but in 4.3 it blocks the UI. The UI doesn't respond. I read that this was the suggested way to do repeating animations in iOS version 4.0 or greater (>= 4.0). The culprit seems to be UIViewAnimationOptionRepeat. Do you see any obvious errors I'm making?

like image 622
schellsan Avatar asked Jan 24 '12 18:01

schellsan


1 Answers

You should probably be including UIViewAnimationOptionAllowUserInteraction as well.

like image 67
Noah Witherspoon Avatar answered Jan 16 '23 11:01

Noah Witherspoon