Parcourir la source

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

liangdahong il y a 4 ans
Parent
commit
6a73c83bcd
1 fichiers modifiés avec 13 ajouts et 0 suppressions
  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 {
     deinit {
         if isDisplayLinkInitialized {
         if isDisplayLinkInitialized {
             displayLink.invalidate()
             displayLink.invalidate()