Ios 在Swift3中更改UIImage动画的原点
我有以下代码,基本上只是将UIImage从0增长到其预期高度:Ios 在Swift3中更改UIImage动画的原点,ios,animation,swift3,uiimage,Ios,Animation,Swift3,Uiimage,我有以下代码,基本上只是将UIImage从0增长到其预期高度: let bounds = self.tankLevelRep.bounds UIView.transition(with: self.tankLevelRep, duration: 2.0, animations: {self.tankLevelRep.bounds = CGRect(x: bounds.origin.x, y: bounds.origin.y, width: bounds.size.width, height:
let bounds = self.tankLevelRep.bounds
UIView.transition(with: self.tankLevelRep, duration: 2.0, animations: {self.tankLevelRep.bounds = CGRect(x: bounds.origin.x, y: bounds.origin.y, width: bounds.size.width, height: 118.0)}, completion: nil)
除了它是从中间生长出来的以外,这一切都很好。我希望它从底部向上生长。随附的图形在动画接近结束时显示动画。可以看到,动画不是从底部开始,而是从中心开始,并向外生长。我希望它从底部开始,图像向上生长
为了实现这一点,我可以在代码中更改什么
注:
•“tankLevelRep”是我的UIImage的门店名称
您应该更新帧和边界镜像更改,在代码中,确保通过将原点设置为
bounds.size.height
而不是origin.y
从底部设置动画。这里是一个很好的填充动画从另一个