         }
     }
     
+    public var centerIndex: Int { return Int(round(Double(buttons.count)/2.0)) - 1 }
+    
+    
+    public var isCustomCenterButton: Bool {
+        var result = false
+        if let centerType = currentCenterButton, centerType == .checkmark || centerType == .save {
+            result = true
+        }
+        return result
+    }
+    
+    public func setCenterButton(type: CenterButtonType) {
+        if let current = currentCenterButton, current == type {
+            return
+        }
+        currentCenterButton = type
+    }
+    
+    public var blackLineHidden: Bool {
+        get {
+            return blackLine.isHidden
+        }
+        set {
+            blackLine.isHidden = newValue
+        }
+    }
+    
+    
+    private var currentCenterButton: CenterButtonType? {
+        didSet {
+            guard let centerType = currentCenterButton else {  return  }
+            let image = UIImage(named: centerType.rawValue)!
+            
+            let isHighlighted = self.highlightedButtonIndexes.contains(centerButtonOverlay)
+            let highlightedImage = UIImage(named: centerType.selected)
+            //.withRenderingMode(.alwaysOriginal)//selectedImages[centerIndex]
+            
+            var color: UIColor!
+            if isHighlighted{
+                color = self.highlightedBackgroundColor ?? UIColor.black
+            }else{
+                color = self.selectedColor ?? UIColor.black
+                
+            }
+            //            centerButtonOverlay.setImage(ignoreIconColors ? image : image.withRenderingMode(.alwaysTemplate), for: .normal)
+            //
+            //            centerButtonOverlay.setImage(ignoreIconColors ? image : image.imageWithColor(color: defaultColor), for: [])
+            //            centerButtonOverlay.setImage(ignoreIconColors ? image : image.imageWithColor(color: defaultColor), for: .highlighted)
+            //
+            //            centerButtonOverlay.setImage(ignoreIconColors ? image : image.imageWithColor(color: selectedColor), for: .selected)
+            //            centerButtonOverlay.setImage(ignoreIconColors ? image : image.imageWithColor(color: selectedColor), for: [.normal, .selected, .highlighted])
+            
+            //            self.updateInterfaceIfNeeded()
+            
+            
+            centerButtonOverlay.customizeForTabBarWithImage(image,
+                                                            highlightImage: highlightedImage,
+                                                            selectedColor: color,
+                                                            highlighted: isHighlighted,
+                                                            defaultColor: self.defaultColor ?? UIColor.gray,
+                                                            highlightColor: self.highlightColor ?? UIColor.white,
+                                                            ignoreColor: ignoreIconColors)
+            //            tabItem.image = image
+            //            tabItem.selectedImage = selectedImage
+            //            tabItem.iconView?.icon.image = tabItem.image
+            
+        }
+    }
+
+    
     /// The view that holds the views of the controllers.
     fileprivate var controllersContainer:UIView!
     
     /// The view which holds the buttons.
     fileprivate var buttonsContainer:UIView!
     
+    // The 1px width view at the top of buttons container
+    fileprivate var blackLine:UIView!
+    
     /// The separator line between the controllers container and the buttons container.
     fileprivate var separatorLine:UIView!
     

            if let selectedImages = self.selectedTabIcons {
                highlightedImage = selectedImages[i]
            }
            
            var color: UIColor!
            
            if isHighlighted{

    ///   - animated: To animate or not.
    open func setBar(hidden: Bool, animated: Bool,duration: TimeInterval = 0.3, completion: ((Bool)->Void)? = nil) {
        let animations = {() -> Void in
            self.centerButtonOverlay.alpha = hidden ? 0.0 : 1.0
            self.centerButtonOverlay.isHidden = hidden
            self.buttonsContainerHeightConstraint.constant = hidden ? 0 : self.buttonsContainerHeightConstraintInitialConstant
            self.view.layoutIfNeeded()
        }
