     
     
     func constructScrollControls() -> Void {
-        
+        let sectionInset = self.flowLayout.sectionInset
+        let margin = self.flowLayout.minimumLineSpacing
+        var lastx = sectionInset.left
+        for item in tabItems {
+            let size = titleSize(title: (item as! ArtScrollTabItem).tabTitle!)
+            var height:CGFloat = 0
+            if let h = self.delegate?.artScrollTabHeight?(scrollTab: self) {
+                height = h
+            }
+            (item as! ArtScrollTabItem).tabFrame = CGRect(x: lastx, y: 0, width: size.width, height: height)
+            lastx = lastx + size.width + margin
+        }
     }
     
     func caculateTotalWidth() -> CGFloat {

    //MARK - Properities
    var tabItems = Array<ArtScrollTabDelegate>()
    var selectedColor:UIColor?
    var currentIndex:Int = 0
    
    weak var delegate:ArtScrollTabDelegate?



extension ArtScrollTab: UICollectionViewDelegate,UICollectionViewDataSource {
    
    func registerCells() -> Void {
        self.collectionView.register(ArtScrollTabCell.self, forCellWithReuseIdentifier: "ArtScrollTabCell")
    }
    
    
    func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
        return tabItems.count
    }
    
    func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
        let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "ArtScrollTabCell", for: indexPath) as! ArtScrollTabCell
        
        if let item = (tabItems[indexPath.item]) as? ArtScrollTabItem {
            cell.titleLabel.text = item.tabTitle
        }
        return cell
    }
    
    func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize {
        if let item = (tabItems[indexPath.item]) as? ArtScrollTabItem {
            return (item.tabFrame?.size)!;
        }
        
        return CGSize.zero
    }
    

    
}

