         let offset = scrollView.contentOffset.x
         if offset == 0 {
             self.indexOfCurrentImage = self.getLastImageIndex(indexOfCurrentImage: self.indexOfCurrentImage)
+            self.currentIndex = self.previousIndex()
         }else if offset == self.frame.size.width * 2 {
             self.indexOfCurrentImage = self.getNextImageIndex(indexOfCurrentImage: self.indexOfCurrentImage)
+            
+            self.currentIndex = self.nextIndex()
         }
         // 重新布局图片
         self.setScrollViewOfImage()

        
        let tempIndex = self.currentIndex - 1
        guard tempIndex >= 0 else {
            return 0
        }
        return tempIndex
    }

        
        let tempIndex = self.currentIndex + 1
        guard tempIndex < self.data.count else {

            return 0//self.data.count - 1
        }
        return tempIndex
    }
