【发布时间】:2020-02-21 05:57:19
【问题描述】:
以前在 swift 中你可以这样做:
let animator = UIViewPropertyAnimator(duration: 0.25, curve: .easeIn) {
UIView.setAnimationRepeatCount(Float.infinity)
UIView.setAnimationRepeatAutoreverses(true)
let transform = CATransform3DIdentity
let rotate = CATransform3DRotate(transform, 45, 1, 1, 0)
self.ex.layer.transform = rotate
}
但是,现在 UIView.setAnimationRepeatCount 和 UIView.setAnimationRepeatAutoreverses 上有一条弃用消息。有人知道他们被什么替换了吗?我仍然可以使用UIViewPropertyAnimator,还是必须使用CABasicAnimation 之类的东西?
消息是:
'setAnimationRepeatCount' 在 iOS 13.0 中已弃用:改用基于块的动画 API
“setAnimationRepeatAutoreverses”在 iOS 13.0 中已弃用:改用基于块的动画 API
【问题讨论】:
标签: swift ios13 uiviewpropertyanimator