在动画约束的同时更改 UIImageView 图像

问题描述

当尝试更改 UIImageView 的图像同时为其约束设置动画时,图像似乎暂时出现故障 - 整个图像旋转了 90 度。一旦动画完成,它就会自行纠正。

self.imageViewContainerTopConstraint.constant = 100
self.imageViewContainerLeadingConstraint.constant = 50
self.imageViewContainerTrailingConstraint.constant = 50
self.imageViewContainerBottomConstraint.constant = 100
            
self.view.setNeedsLayout()
            
UIView.animate(withDuration: 1.0,delay: 0,options: [.curveEaSEOut],animations: {
    self.view.layoutIfNeeded()
},completion: nil)

UIView.transition(with: self.imageView,duration: 0.5,options: [.transitionCrossdissolve],animations: {
    self.imageView.image = UIImage(named: "test")
},completion: nil)

如何在不出现故障的情况下实现约束和图像的动画?

之前:

Before

动画期间:

During Animation

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)