     }
 }
 
+// MARK: -处理timer
+extension RecycleHeaderView {
 
+    fileprivate func addTimer() {
+        timer = Timer.scheduledTimer(timeInterval: 3.0, target: self, selector: #selector(self.scrollToNext), userInfo: nil, repeats: true)
+        RunLoop.main.add(timer!, forMode: .commonModes)
+    }
+    
+    fileprivate func stopTimer() {
+        timer?.invalidate()
+        timer = nil
+    }
+    
+    @objc fileprivate func scrollToNext() {
+        let currentOffsetX = recycleCollecView.contentOffset.x
+        let offset = currentOffsetX + recycleCollecView.bounds.width
+        
+        recycleCollecView.setContentOffset(CGPoint(x: offset, y: 0), animated: true)
+    }
+}
+
+

        layout.itemSize = recycleCollecView.bounds.size
    }
    
    var recycleModelArr : [RecycleModel]? {
        didSet {
            guard recycleModelArr != nil else { return }
            
            recycleCollecView.reloadData()
            
            pageController.numberOfPages = recycleModelArr!.count
            
            let path = IndexPath(item: recycleModelArr!.count * 50, section: 0)
            recycleCollecView.scrollToItem(at: path, at: .left, animated: false)
        }
    }
    
    
    
}



        pageController.currentPage = count % recycleModelArr!.count
    }
    
    func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
        stopTimer()
    }
    
    func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) {
        addTimer()
    }
}

// MARK: -提供个类方法创建view
