ios - Swift3 淡入/淡出或平滑过渡 UIImageView 动画图像

标签 ios swift swift3 uiimageview uiviewanimationtransition

我正在尝试制作图像幻灯片

在 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/

相关文章:

iOS - 独立于时区的本地通知

ios - 如何从可选函数 didMoveToPage 中获取索引?

ios - 为什么在延迟调用时循环迭代有时会被打乱? [代码和输出]

iphone - iOS 使用间隔和自定义单元格制作自定义表格 View

iphone - 模态视图中的淡出过渡

ios - 当 iPad 旋转到横向时调整 UIImageView 的尺寸

ios - 消息发送到已释放实例 Core Data

ios - 如何向 UIButton 操作添加 UIAccessibility 功能?

ios - 在 UIButton 中添加右 View

swift 3 : How do I tap a button inside cell and pass in that indexPath of that cell?