如何使用UIView关键帧动画为UIImpactFeedbackGenerator计时?

时间:2017-04-01 08:37:22

标签: ios iphone swift xcode animation

我尝试将影响反馈添加到自定义视图控制器演示文稿中。动画在关键帧中实现,并且在结尾处有反弹,因此我无法在presentationTransitionDidEnd中执行此操作。我的关键帧看起来像:

UIView.animateKeyframes(withDuration: 0.6, delay: 0, options: [], animations: {
    UIView.addKeyframe(withRelativeStartTime: 0, relativeDuration: 0.5, animations: {
        // View controller hits its full size; I'd like feedback at the end of this
    }
    UIView.addKeyframe(withRelativeStartTime: 0.5, relativeDuration: 0.25, animations: {
        // Expand for bounce
    }
    UIView.addKeyframe(withRelativeStartTime: 0.75, relativeDuration: 0.25, animations: {
        // Back to normal size
    }
}, completion: { ... })

有没有办法在关键帧动画中的特定点运行代码块?将它放在块内是不起作用的。

0 个答案:

没有答案