 
 class RecycleHeaderView: UIView {
 
+    // MARK: -xib控件
     @IBOutlet weak var recycleCollecView: UICollectionView!
     @IBOutlet weak var pageController: UIPageControl!
     
+    // MARK: -系统回调函数
     override func awakeFromNib() {
         super.awakeFromNib()
         


        pageController.currentPage = count % recycleModelArr!.count
    }
}

// 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?
    
}

