             objc_setAssociatedObject(self, _gifImageKey, newValue, objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN);
         }
     }
-        public var currentImage:UIImage{
+    public var currentImage:UIImage{
         get {
             return (objc_getAssociatedObject(self, _currentImageKey) as! UIImage)
         }

            self.cache.setObject(image,forKey:i)
        }
    }
    
    public var gifImage:UIImage{
        get {
            return (objc_getAssociatedObject(self, _gifImageKey) as! UIImage)

                StartDisplay()
            }
            if(isDiscarded(self)==true){
                self.animationManager?.DeleteImageView(self)
            }
        }
    }

    public func isDiscarded(imageView:UIView?) -> Bool{
        if(imageView == nil || imageView!.superview == nil){
            return true
        }
        return false
    }


    public func isDisplayedInScreen(imageView:UIView?) ->Bool{
        if (self.hidden) {
            return false
        }
        let screenRect = UIScreen.mainScreen().bounds
        let viewRect = imageView!.convertRect(self.frame,toView:UIApplication.sharedApplication().keyWindow)

        let intersectionRect = CGRectIntersection(viewRect, screenRect);
        if (CGRectIsEmpty(intersectionRect) || CGRectIsNull(intersectionRect)) {
            return false
        }
        return true
    }

    private func updateIndex(){
        self.syncFactor = (self.syncFactor+1)%gifImage.displayRefreshFactor!
        if(self.syncFactor==0){
