     
     
     //定义属性
+    var cycleTimer: NSTimer?
     var cycleModels: [CycleModel]?{
     
         didSet{


    func scrollViewDidScroll(scrollView: UIScrollView) {
        let currentOffX = scrollView.contentOffset.x + scrollView.bounds.width * 0.5
      pageControl.currentPage =  Int(currentOffX / scrollView.bounds.width)
    }
    
    
}





            
             //设置pageController的个数
            pageControl.numberOfPages = cycleModels?.count ?? 0
            //设置collectionView默认滚动位置
            let indexPath = NSIndexPath(forItem:(cycleModels?.count ?? 0) * 10, inSection: 0)
            
            collection.scrollToItemAtIndexPath(indexPath, atScrollPosition: .Left, animated: false)
            
            //添加定时器
            removeCycleTimer()
            addCycleTimer()
        }
    }

