                 }) { (finished) -> Void in
 
                     self.imageView.stopAnimating()
+                    self.imageView.index = 0
 
             }
         }


            //We cannot do this in the previous if/else because then some frames
            //might not be drawn
            if !refreshing && superview.contentOffset.y + topInset < 0 {
                let percentage = min(1, fabs(height) / expandedHeight)
                let count = CGFloat(imageView.animatedImage?.frameCount ?? 1) - 1
                let index = UInt(count * percentage)

////////////////////////////////////////////////////////////////////////////

private class GIFAnimatedImageView: UIImageView {
    var animatedImage: AnimatedImage? {
        didSet {
            image = animatedImage?[0]
        }
    }
    var animating = false
    var lastTimestampChange = CFTimeInterval(0)

    lazy var displayLink: CADisplayLink = {
        let dl = CADisplayLink(target: self, selector: "refreshDisplay")
        dl.addToRunLoop(NSRunLoop.mainRunLoop(), forMode: NSRunLoopCommonModes)
        dl.paused = true
        return dl
    }()

    var index = UInt(0) {
