我正在制作一个卡片应用程序,我需要制作一个动画,以便卡片可以更改其约束以移动到另一个地方。我将如何为 UIImage 执行此操作。
最佳答案
Hook UIImageView 的前导、尾随、CenterX 或 CenterY 约束并执行此操作
self.imageLeadCon.constant = // value
UIView.animate(withDuration: 3.0 , animations: {
self.view.layoutIfNeeded()
// animation
}, completion: { _ in
// completion
})
关于ios - 如何在 Swift 4 中为 UIImage 约束设置动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48269404/