         fatalError("init(coder:) has not been implemented")
     }
     
+    // MARK: - Private
+    
+    func playBanner() {
+        if currentIndex == self.imgArr.count { // 滚动到最后一页
+            currentIndex = 1
+        } else {
+            currentIndex += 1
+        }
+        
+         self.scrollView .setContentOffset(CGPoint(x: self.scrollView.frame.width * CGFloat(currentIndex), y: 0), animated: true)
+    }
+    
+    private func stopTimer() {
+        self.timer.invalidate()
+        self.timer = nil
+    }
+    
+    private func startTimer() {
+        self.timer = Timer.scheduledTimer(timeInterval: 3, target: self, selector:#selector(playBanner), userInfo: nil, repeats: true)
+        RunLoop.current.add(self.timer, forMode: .commonModes)
+    }
     
     // MAARK: - UIScrollViewDelegate
     

    }
    
    func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
        
    }
    
    func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
        
    }
    
    // MARK: SetUp

            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)
    }
    
}
