gpt4 book ai didi

ios - 如何让CAKeyframeAnimation在动画期间与用户交互?

转载 作者:行者123 更新时间:2023-11-30 12:31:09 48 4
gpt4 key购买 nike

CAKeyframeAnimation 不喜欢这样:

[UIView animateWithDuration:0.0 delay:0.0 options:UIViewAnimationOptionAllowUserInteraction animations:^{
..
} completion:nil];

我们无法设置options:UIViewAnimationOptionAllowUserInteraction。有谁有一个好主意让它在动画期间与用户交互?

最佳答案

我解决了设置计时器以在动画期间更新帧的问题。

//Timer: To update the UI frame
Timer.scheduledTimer(timeInterval: 0.15, target: self, selector: #selector(updateFrame), userInfo: nil, repeats: true)

//Timer Selector
@objc func updateFrame(){
//getting the layer presentation bounds
let layer = "button, label...".layer.presentation()!

let point = CGPoint(x: layer.frame.origin.x, y: layer.frame.origin.y)
let size = CGSize(width: layer.frame.width, height: layer.frame.height)
// Update the UI element frame location
"ui element".frame = CGRect(origin: point, size: size)
}

关于ios - 如何让CAKeyframeAnimation在动画期间与用户交互?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43539001/

48 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com