Explorar o código

Merge pull request #1805 from leonpesdk/fix/animated-image-view

Fixed animated image view for iOS 13 and below
Wei Wang %!s(int64=4) %!d(string=hai) anos
pai
achega
c8cbaf4d51
Modificáronse 2 ficheiros con 13 adicións e 1 borrados
  1. 8 0
      CHANGELOG.md
  2. 5 1
      Sources/Views/AnimatedImageView.swift

+ 8 - 0
CHANGELOG.md

@@ -2,6 +2,14 @@
 
 -----
 
+## [Unreleased]
+
+#### Fix
+
+* Fix `AnimatedImageView` crashing on iOS 13 and below. [#1804]
+
+---
+
 ## [7.0.0-beta.3 - Version 7](https://github.com/onevcat/Kingfisher/releases/tag/7.0.0-beta.3) (2021-08-29)
 
 #### Add

+ 5 - 1
Sources/Views/AnimatedImageView.swift

@@ -230,7 +230,11 @@ open class AnimatedImageView: UIImageView {
         if let currentFrame = animator?.currentFrameImage {
             layer.contents = currentFrame.cgImage
         } else {
-            super.display(layer)
+            if #available(iOS 15.0, *) {
+                super.display(layer)
+            } else {
+                layer.contents = image?.cgImage
+            }
         }
     }