使用UIView.animate使动画继续完成吗?

时间:2019-04-17 18:34:01

标签: swift animation uiviewanimation

要使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???
  }

这可能吗?

0 个答案:

没有答案