下面的相關代碼。我希望每個圖像在出現在整個動畫週期中時都具有淡入效果。運行此代碼時,gif動畫會影響工作,但不透明度更改的代碼不會。任何幫助將不勝感激。謝謝!如何在iOS中更改動畫gif圖像的不透明度
import UIKit
class View1: UIViewController {
@IBOutlet weak var imageView: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
var imagesNames = ["ALA0.jpeg", "ALA1.jpeg", "ALA2.png", "ALA3.png", "ALA4.png", "ALA5.png", "ALA6.png", "ALA7.png", "ALA8.png", "ALA9.png", "ALA10.png"]
var images = [UIImage]()
for i in 0..<imagesNames.count{
images.append(UIImage(named: imagesNames[i])!)
imageView.alpha = 0
UIImageView.animate(withDuration: 1.0) {
self.imageView.alpha = 1
}
}
imageView.animationImages = images
imageView.animationDuration = 6.0
self.imageView.startAnimating()
}
}
對不起我的壞...讓我看看...謝謝你讓我知道...謝謝 – Joe
代碼updated.let我知道代碼適用於周到,謝謝 – Joe