【发布时间】:2017-12-03 15:51:08
【问题描述】:
我有一个 UIImageView 对象,它位于全屏屏幕的中心。我制作了一个动画,在相同的代码中执行缩放和平移。以下是源代码:
UIView.animate(withDuration: 1.0, animations: {
let originalTransform = self.idImageView.transform
let scaledTransform = originalTransform.scaledBy(x: 0.2, y: 0.2)
let scaledAndTranslatedTransform = scaledTransform.translatedBy(x: 100, y: 100)
self.idImageView.transform = scaledAndTranslatedTransform
}, completion: { (finished) in
self.animationCompeletedSuccessfully(finished)
})
我希望我的 UIImageView 移动到 x=100 和 y=100 的坐标,但平移会将其相对于中心移动 100 点。我如何在窗口坐标系上翻译它? Apple Documentation of traslatedBy(x: , y:) 我读过这一篇,但无法清楚地了解协调系统
【问题讨论】:
标签: ios swift animation uiviewanimation translate-animation