Просмотр исходного кода

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

xspyhack 9 лет назад
Родитель
Сommit
b358425873
1 измененных файлов с 8 добавлено и 2 удалено
  1. 8 2
      Sources/AnimatedImageView.swift

+ 8 - 2
Sources/AnimatedImageView.swift

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