             self.scrollView.addSubview(imgView)
         }
         
+        currentIndex = 1
+        
         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)
+        
+        self.timer = Timer.scheduledTimer(timeInterval: 3, target: self, selector:#selector(playBanner), userInfo: nil, repeats: true)
+        RunLoop.current.add(self.timer, forMode: .commonModes)
     }
     
 }

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

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