 
         pageController.currentPage = count % recycleModelArr!.count
     }
+    
+    func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
+        stopTimer()
+    }
+    
+    func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) {
+        addTimer()
+    }
 }
 
 // MARK: -提供个类方法创建view

    }
}



        layout.itemSize = recycleCollecView.bounds.size
    }
    
    // MARK: -自定义属性
    var recycleModelArr : [RecycleModel]? {
        didSet {
            guard recycleModelArr != nil else { return }
            
            // 1.刷新数据
            recycleCollecView.reloadData()
            
            // 2.设置pageController的总个数
            pageController.numberOfPages = recycleModelArr!.count
            
            // 3.设置collectionView滚动到中间某个位置
            let path = IndexPath(item: recycleModelArr!.count * 50, section: 0)
            recycleCollecView.scrollToItem(at: path, at: .left, animated: false)
            
            // 4.添加定时器
            addTimer()
        }
    }
    
    /// 定时器
    fileprivate var timer : Timer?
    
}

