2017-04-01 86 views
0

我試圖做一個圖像幻燈片Swift3淡入/淡出或平滑過渡的UIImageView animationImages

什麼是做一個UIImageView(Swift3)增加對animationImages平穩過渡的最佳途徑

這裏我爲幻燈片顯示的代碼:

 DispatchQueue.main.async { 
       imageView.animationImages = activeImages 
       imageView.clipsToBounds = true 
       imageView.animationDuration = (1.0 * Double(activeImages.count)) 
       imageView.animationRepeatCount = Int.max 
       imageView.startAnimating() 
     } 

回答

0

使用UIVIew.animate塊和兩個UIImageViews的轉換,它們常被用來生產非常乾淨的代碼。

UIView.animate(withDuration: 0.3, 
       delay: 0, 
       options: .curveEaseInOut, //just an example, check UIViewAnimationOptions 
       animations: { 
     self.image1.alpha = 0 
     self.image2.alpha = 1 
}) 
+0

我想要一張無限期地重複播放20張圖片的幻燈片,我認爲UIVIew.animate對臨時動畫更好,不是嗎? – MarionFlex

+0

這個迴應不是用戶想在這裏解決的 – Pierre