per*_*adi 7 animation uiview ios swift ios13
我有一个数组,UIViewPropertyAnimator像在有关动画的WWDC视频中一样使用它,在iOS 13之前,一切正常,在iOS 13中,动画框架无法正确更新。例如:我有一个UIViewPropertyAnimator调用labelAnimator,它使标签动画化为某些特定的CGRect,而这CGRect不受尊重,并且标签动画化了其他地方。以下是该动画的视频:https :
//www.youtube.com/watch?v=
BcgkQp2zIsk iOS 13位于左侧,iOS 12位于右侧。
let textAnimator = UIViewPropertyAnimator(duration: duration, timingParameters: linearTiming)
textAnimator.addAnimations {
switch state{
case .expanded:
self.tempLabel.transform = CGAffineTransform(scaleX: 0.6, y: 0.6)
self.tempLabel.frame = CGRect(origin: CGPoint(x: 15, y: self.diff / 2 - self.tempLabel.frame.height / 2), size: self.tempLabel.frame.size)
case .collapsed:
self.tempLabel.transform = CGAffineTransform.identity
self.tempLabel.frame = CGRect(origin: CGPoint(x: 15, y: self.view.frame.height / 2 - self.tempLabel.frame.height / 2 - 30), size: self.tempLabel.frame.size)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
920 次 |
| 最近记录: |