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