【问题标题】:animateWithDuration:delay:options:animations:completion: blocking UI when used with UIViewAnimationOptionRepeat | UIViewAnimationOptionAutoreverseanimateWithDuration:delay:options:animations:completion: 与 UIViewAnimationOptionRepeat 一起使用时阻塞 UI | UIViewAnimationOptionAutoreverse
【发布时间】:2012-01-24 18:45:27
【问题描述】:

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

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

【问题讨论】:

  • 我刚刚遇到了同样的问题。直到今天我才在 iOS 4.3 上进行测试。出于某种原因,iOS 5 及更高版本的 UIViewAnimationOptionAllowUserInteraction 似乎设置为 true。

标签: ios ios5 core-animation ios4


【解决方案1】:

您可能也应该包括UIViewAnimationOptionAllowUserInteraction

【讨论】:

    猜你喜欢
    • 2012-04-15
    • 2014-09-13
    • 2023-03-19
    • 1970-01-01
    • 2020-12-21
    • 1970-01-01
    • 2017-07-16
    • 2018-10-18
    • 1970-01-01
    相关资源
    最近更新 更多