要使CAKeyframeAnimation
继续执行,您可以像这样将isRemovedOnCompletion
设置为false:
blahView.layer.add(animation, forKey: nil)
animation.isRemovedOnCompletion = false
当您使用UIView.animate时,我试图弄清楚该怎么做:
UIView.animate(withDuration: Double.random(in: 2.7...3.7), delay: 0,
options: [.curveEaseInOut, .repeat, .autoreverse, .allowUserInteraction], animations: {
button.transform = CGAffineTransform(translationX: 50, y: 60)
}){ _ in
button.removeFromSuperview() // How do you set this to false???
}
这可能吗?