下面的相关代码。我希望每个图像在出现在整个动画周期中时都具有淡入效果。运行此代码时,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