         let width:CGFloat = self.scrollView.frame.width
         print("偏移量\(offsetX)")
         if offsetX < width {
-            self.scrollView.contentOffset = CGPoint(x: width * CGFloat(self.imgArr.count), y: 0)
+            self.scrollView .setContentOffset(CGPoint(x: width * CGFloat(self.imgArr.count), y: 0), animated: true)
         }
         
         if offsetX > (width * CGFloat(self.imgArr.count)) {
-            self.scrollView.contentOffset = CGPoint(x: width, y: 0)
+               self.scrollView .setContentOffset(CGPoint(x: width, y: 0), animated: true)
         }
         
         

            self.scrollView.addSubview(imgView)
        }
        
        self.pageControl.numberOfPages = count
        self.pageControl.currentPage = 0
        self.addSubview(self.pageControl)
        
        self.scrollView.contentOffset = CGPoint(x: width, y: 0)
        self.scrollView.contentSize = CGSize(width: width * CGFloat(count + 2), height: self.scrollView.frame.height)
    }
    
}

    var pageControl:UIPageControl!
    var timer:Timer!
    var imgArr:[String] = []
    var currentIndex:Int = 0
    
    override init(frame: CGRect) {
        super.init(frame: frame)
