     deinit {
         stopAnimating()
     }
-    
-    /**
-    This method will be called by system when this view is removed from windown (or its superview)
-    The animation is stopped in this method, that means you cannot play the animation offscreen.
-    */
-    override public func didMoveToWindow() {
-        //TODO: Change to globle timer later to solve possible retain cycle from offscreen animation.
-        super.didMoveToWindow()
-        if window == nil {
-            stopAnimating()
-        }
-    }
 
     /**
     Initialize an APNG image view with a decoder.

        }
        
    }
}
        }
        
        isAnimating = true
        timer = CADisplayLink.apng_displayLink({ [weak self] (displayLink) -> () in
            self?.tick(displayLink)
        })
        timer?.addToRunLoop(mainRunLoop, forMode: NSDefaultRunLoopMode)
    }
    
