         if nextIndex >= self.totalPages! {
             nextIndex = 0
         }
-        
+
         return (prevIndex, self.curPage!, nextIndex)
     }
-    
+
     private func refreshImages() {
         let page = self.getCurrentPage()
-        
+
         // 判断缓存
         if self.imageCacheDict[page.0] != nil {
             self.prevImageView.image = self.imageCacheDict[page.0]

        let constraints2 = NSLayoutConstraint.constraints(withVisualFormat: "V:|[scrollView]|", options: NSLayoutFormatOptions.alignmentMask, metrics: nil, views: ["scrollView": self.scrollView])
        self.addConstraints(constraints1)
        self.addConstraints(constraints2)
        
        // 布局ImageViews
        let constraints3 = NSLayoutConstraint.constraints(withVisualFormat: "H:|[i1(width)][i2(width)][i3(width)]|", options: NSLayoutFormatOptions.alignAllTop, metrics: ["width": self.bounds.width], views: ["i1": self.prevImageView, "i2": self.curImageView, "i3": self.nextImageView])
        let constraints4 = NSLayoutConstraint.constraints(withVisualFormat: "V:|[i1(height)]|", options: NSLayoutFormatOptions.alignmentMask, metrics: ["height": self.bounds.height], views: ["i1": self.prevImageView])
        let constraints5 = NSLayoutConstraint.constraints(withVisualFormat: "V:|[i2(height)]|", options: NSLayoutFormatOptions.alignmentMask, metrics: ["height": self.bounds.height], views: ["i2": self.curImageView])
        let constraints6 = NSLayoutConstraint.constraints(withVisualFormat: "V:|[i3(height)]|", options: NSLayoutFormatOptions.alignmentMask, metrics: ["height": self.bounds.height], views: ["i3": self.nextImageView])
//        self.prevImageView.backgroundColor = UIColor.red
//        self.curImageView.backgroundColor = UIColor.green
//        self.nextImageView.backgroundColor = UIColor.blue
        self.scrollView.addConstraints(constraints3)
        self.scrollView.addConstraints(constraints4)
        self.scrollView.addConstraints(constraints5)
        self.scrollView.addConstraints(constraints6)
        self.scrollView.setContentOffset(CGPoint(x: self.bounds.width, y: 0), animated: true)
    }
    
    // MARK: - Life Cycle
    override public func layoutSubviews() {
        super.layoutSubviews()
        self.layoutMyViews()
    }
    
    convenience public init() {
        self.init(frame: CGRect.zero)
    }
    
    override public init(frame: CGRect) {
        super.init(frame: frame)
        self.addMyViews()
    }
    
    required public init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        self.addMyViews()

        self.scrollView.showsHorizontalScrollIndicator = false
        self.scrollView.showsVerticalScrollIndicator = false
        self.scrollView.translatesAutoresizingMaskIntoConstraints = false

        self.curImageView.contentMode = UIViewContentMode.scaleAspectFit
        self.curImageView.clipsToBounds = true
        self.curImageView.translatesAutoresizingMaskIntoConstraints = false
        self.curImageView.isUserInteractionEnabled = true
        self.curImageView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(CedCircleView.imageViewClickAction)))

        self.prevImageView.contentMode = UIViewContentMode.scaleAspectFit
        self.prevImageView.clipsToBounds = true
        self.prevImageView.translatesAutoresizingMaskIntoConstraints = false

        self.nextImageView.contentMode = UIViewContentMode.scaleAspectFit
        self.nextImageView.clipsToBounds = true
        self.nextImageView.translatesAutoresizingMaskIntoConstraints = false

        self.addSubview(self.scrollView)
        self.scrollView.addSubview(self.curImageView)
        self.scrollView.addSubview(self.prevImageView)
        self.scrollView.addSubview(self.nextImageView)
    }

    func layoutMyViews() {
        guard self.scrollView.superview != nil && self.nextImageView.superview != nil && self.curImageView.superview != nil && self.prevImageView.superview != nil else {
            return
