草庐IT

ios - 动画持续时间 :delay:options:animations:completion: blocking UI when used with UIViewAnimationOptionRepeat | UIViewAnimationOptionAutoreverse

coder 2023-07-30 原文

我正在运行一个函数来脉冲播放图标:

- (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。你看到我犯了什么明显的错误吗?

最佳答案

您可能还应该包括 UIViewAnimationOptionAllowUserInteraction

关于ios - 动画持续时间 :delay:options:animations:completion: blocking UI when used with UIViewAnimationOptionRepeat | UIViewAnimationOptionAutoreverse,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8992273/

有关ios - 动画持续时间 :delay:options:animations:completion: blocking UI when used with UIViewAnimationOptionRepeat | UIViewAnimationOptionAutoreverse的更多相关文章

随机推荐