     
     private func makeUI()
     {
+        
+        layout = CycleViewLayout()
+        collectionView = UICollectionView(frame: frame, collectionViewLayout: layout)
+        addSubview(collectionView!)
+        layout.minimumLineSpacing = 0
+        layout.minimumInteritemSpacing = 0
+        
         backgroundColor = UIColor.redColor()
+        
+        collectionView?.registerClass(UICollectionViewCell.self, forCellWithReuseIdentifier: "1111")
+        collectionView?.pagingEnabled = true
+        
+        
     
+    }
+    
+    override func layoutSubviews() {
+        super.layoutSubviews()
+        
+        print("---")
+        collectionView!.frame = self.bounds
+        collectionView!.backgroundColor = UIColor.greenColor()
+        collectionView?.delegate = self
+        collectionView?.dataSource = self
+        
+        if let cv = collectionView {
+            layout.itemSize = cv.bounds.size ?? CGSizeZero
+        }
+        
+        
+        layout.scrollDirection = .Horizontal
+        layout.sectionInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
+
+        
     }
     
     


class CycleScrollView: UIView {
    
    var imagesURL = []
    let images = []
    
    var placeholder:UIImage?
    
    convenience init(placeholder: UIImage,imagesURL:[String]) {
        let size = placeholder.size
        self.init(frame: CGRect(origin: CGPointZero, size: size))
        self.imagesURL = imagesURL
        
    }


    */

}

extension CycleScrollView :UICollectionViewDelegate,UICollectionViewDataSource
{
    
    func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
        print(images.count)
        
        return 5
    }
    
    func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
        
      let cell = collectionView.dequeueReusableCellWithReuseIdentifier("1111", forIndexPath: indexPath)
        
        if indexPath.item % 2 == 0 {
            cell.backgroundColor = UIColor.blueColor()
        }else
        {
            cell.backgroundColor = UIColor.redColor()
        
        }
        
        
        
        
            return cell
    }
    
       
  


}

class CycleViewLayout: UICollectionViewFlowLayout
{
    override func prepareLayout() {
        super.prepareLayout()
    }
    
    
    


}


