我正在尝试制作图像幻灯片
在 UIImageView (Swift3) 中为动画图像添加平滑过渡的最佳方法是什么
这是我的幻灯片代码:
DispatchQueue.main.async {
imageView.animationImages = activeImages
imageView.clipsToBounds = true
imageView.animationDuration = (1.0 * Double(activeImages.count))
imageView.animationRepeatCount = Int.max
imageView.startAnimating()
}
最佳答案
使用 UIVIew.animate
block 和两个 UIImageViews
进行过渡,它们很常用并且生成非常干净的代码。
UIView.animate(withDuration: 0.3,
delay: 0,
options: .curveEaseInOut, //just an example, check UIViewAnimationOptions
animations: {
self.image1.alpha = 0
self.image2.alpha = 1
})
关于ios - Swift3 淡入/淡出或平滑过渡 UIImageView 动画图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43162403/