xmartlabs/XLPagerTabStrip

Vertically Centralising text in BarButtonView

Open

#411 opened on Jul 4, 2017

View on GitHub
 (2 comments) (2 reactions) (0 assignees)Swift (6,965 stars) (1,319 forks)batch import
help wanted

Description

What is the best way of vertically centralising the text of each collection view cell?

Here are my settings

`settings.style.buttonBarItemLeftRightMargin = 20 settings.style.buttonBarItemsShouldFillAvailableWidth = false settings.style.buttonBarItemFont = .systemFont(ofSize: 13, weight: 0.1) settings.style.buttonBarItemTitleColor = UIColor(red:255/255.0, green:255/255.0, blue:255/255.0, alpha:0.8)

    settings.style.buttonBarBackgroundColor = UIColor(red:255/255.0, green:255/255, blue:255/255.0, alpha:1.0)
    settings.style.buttonBarItemBackgroundColor = UIColor(red:255/255.0, green:255/255.0, blue:255/255.0, alpha:1.0)
    settings.style.selectedBarBackgroundColor = UIColor(red:32/255.0, green:163/255.0, blue:213/255.0, alpha:1.0)
    settings.style.selectedBarHeight = 2
    
    settings.style.buttonBarMinimumLineSpacing = 0
    settings.style.buttonBarLeftContentInset = 20
    settings.style.buttonBarRightContentInset = 20
    changeCurrentIndexProgressive = { [weak self] (oldCell: ButtonBarViewCell?, newCell: ButtonBarViewCell?, progressPercentage: CGFloat, changeCurrentIndex: Bool, animated: Bool) -> Void in
        guard changeCurrentIndex == true else { return }
        oldCell?.label.textColor = self?.nonSelectedColor
        newCell?.label.textColor = self?.selectedColor
        oldCell?.label.font = self?.nonSelectedFont
        newCell?.label.font = self?.selectedFont
    }`

Here is a screenshot, i want to make the gap between the text and the indicator smaller

new screen

Contributor guide