Browse Source

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

liangdahong 4 years ago
parent
commit
6a73c83bcd
1 changed files with 13 additions and 0 deletions
  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()