1
ここにある関数は、次のようにビューをアニメーション化するために書きました:2秒のフェードアウト、2秒のフェードイン、2秒の遅延と繰り返し。何らかの理由でアニメーションが一度だけプリフォームされ、繰り返されません。私はここで間違って何をしていますか?スウィフトで連鎖したアニメーションを繰り返す
UIView.animateWithDuration(6.0,
delay: 0.0,
options: [.AllowUserInteraction,.Repeat,.BeginFromCurrentState],
animations: {
UIView.animateWithDuration(2.0,
delay: 0.0,
options: [.AllowUserInteraction,.BeginFromCurrentState] ,
animations: {
//fade out
self.alpha = 0.5
},
completion: { finished in
UIView.animateWithDuration(2.0,
delay: 0.0,
options: [.AllowUserInteraction,.BeginFromCurrentState],
animations: {
//fade in
self.alpha = 1.0
},
completion: { finished in
UIView.animateWithDuration(2.0,
delay: 0.0,
options: [.AllowUserInteraction,.BeginFromCurrentState],
animations: {
},
completion: { finished in
})
})
})
},
completion: { finished in
})
}
最後の 'animation'の' completion'ブロックには何もありません。アニメーションには何をしたいですか?あなたは単に「セルフ」と呼んでいますか?溶液については – Khuong