 class RecommendCycleView: UIView {
     
     // 定义属性
+    var cycleTimer : Timer?
     var cycleModels : [CycleModel]? {
         didSet {
             // 1,刷新collectionView

        let offsetX = scrollView.contentOffset.x + scrollView.bounds.width * 0.5
        
        // 2,计算pageControl的currentIndex
        pageControl.currentPage = Int(offsetX / scrollView.bounds.width)
    }
}

// MARK:- 遵守UICollectionViewDatasource方法
extension RecommendCycleView : UICollectionViewDataSource {
    func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
        return (cycleModels?.count ?? 0) * 10000
    }
    
    func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
        
        // 1,取出model
        let cycleModel = cycleModels![indexPath.item % cycleModels!.count]
        
        let cell = collectionView.dequeueReusableCell(withReuseIdentifier: kCycleCellID, for: indexPath) as! CollectionCycleCell
        cell.cycleModel = cycleModel
