Răsfoiți Sursa

fix:AnimatedImageView Highlight gif stop play https://github.com/onevcat/Kingfisher/issues/1679

liangdahong 4 ani în urmă
părinte
comite
6a73c83bcd
1 a modificat fișierele cu 13 adăugiri și 0 ștergeri
  1. 13 0
      Sources/Views/AnimatedImageView.swift

+ 13 - 0
Sources/Views/AnimatedImageView.swift

@@ -188,6 +188,19 @@ open class AnimatedImageView: UIImageView {
         }
     }
     
+    open override var isHighlighted: Bool {
+        get {
+            super.isHighlighted
+        }
+        set {
+            // Highlighted image is unsupported for animated images.
+            // See https://github.com/onevcat/Kingfisher/issues/1679
+            if displayLink.isPaused {
+                super.isHighlighted = newValue
+            }
+        }
+    }
+    
     deinit {
         if isDisplayLinkInitialized {
             displayLink.invalidate()