0
UIImageViewオブジェクトは、画面の中央に全画面表示されています。私は同じコードでスケールと翻訳を行うアニメーションを作った。ここではソースコードは次のとおりです。swift - 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:) 私はこの1つを読んだことがあるが、共同ordianteシステムについて明確に
返信いただきありがとうございます。それは部分的に機能しています。どうしてか分かりません。予想されるポイントの近くで私の見解を動かしています。そして私はあなたの最後の行を強調しない。どうか説明できますか? –
あなたの場合、 'destinationX - x + width/2 * 0.2'と' y'と同じ –
コードを編集して実装してください –