Quellcode durchsuchen

Fix 'Cannot form weak reference to instance of class Kingfisher.AnimatedImageView'

xspyhack vor 9 Jahren
Ursprung
Commit
b358425873
1 geänderte Dateien mit 8 neuen und 2 gelöschten Zeilen
  1. 8 2
      Sources/AnimatedImageView.swift

+ 8 - 2
Sources/AnimatedImageView.swift

@@ -100,7 +100,11 @@ public class AnimatedImageView: UIImageView {
     }
     
     override public func isAnimating() -> Bool {
-        return !displayLink.paused
+        if displayLinkInitialized {
+            return !displayLink.paused
+        } else {
+            return super.isAnimating()
+        }
     }
     
     /// Starts the animation.
@@ -115,7 +119,9 @@ public class AnimatedImageView: UIImageView {
     /// Stops the animation.
     override public func stopAnimating() {
         super.stopAnimating()
-        displayLink.paused = true
+        if displayLinkInitialized {
+            displayLink.paused = true
+        }
     }
     
     override public func displayLayer(layer: CALayer) {