0
どのようにして特定のCGPointに行くためにプログラムで作成されたオブジェクトをアニメーション化できますか? CGAffineTransformMakeTranslationを使用しないでください。移動する方法だけであり、移動する場所ではありません。私が試してみましたSwift、特定のCGPointにアニメーションを適用する
:translatesAutoresizingMaskIntoConstraints =
真は、しかし、それは違いはありません。私はこれを試してみました:シミュレータで実行したときに
//Define screen sizes
let screenSize: CGRect = UIScreen.mainScreen().bounds
let screenWidth = screenSize.width
let screenHeight = screenSize.height
// Sizes of centre cards
let centreCardWidth = screenWidth/5
let centreCardHeight = (screenWidth/5)/0.625
let centralizeViewHorizontalCard = (screenWidth/2) - ((screenWidth/5)/2)
let centralizeViewVerticleCard = screenHeight/2
UIView.animateWithDuration(0.25, delay: 0.5, options: [], animations: {
centreCard3.frame = CGRectMake(centralizeViewHorizontalCard, centralizeViewVerticleCard, centreCard3.frame.size.width, centreCard3.frame.size.height)
}, completion: nil)
しかしには、絶対に何も起こりませんでした。
を初期化していますか? – Chajmz
いつこのコードを呼び出していますか? – jrturton
でViewDidLoad。 – RufusV