animateWithDuration:delay:options:animations:completion:与UIViewAnimationOptionRepeat一起使用时阻止UI UIViewAnimationOptionAutoreverse

时间:2012-01-24 18:45:27

标签: ios ios5 core-animation ios4

我正在运行一个脉冲播放图标的功能:

- (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) {}];
}

这在iOS 5.0中非常有效,但在4.3中它会阻止UI。用户界面没有响应。我读到这是在iOS 4.0或更高版本(> = 4.0)中重复制作动画的建议方法。罪魁祸首似乎是UIViewAnimationOptionRepeat。你看到我正在做出任何明显的错误吗?

1 个答案:

答案 0 :(得分:11)

你可能也应该包括UIViewAnimationOptionAllowUserInteraction