xmartlabs/XLPagerTabStrip

Vertically Centralising text in BarButtonView

Aperta

#411 aperta il 4 lug 2017

 (2 commenti) (2 reazioni) (0 assegnatari)Swift (1319 fork)batch import
help wanted

Metriche repository

Star
 (6965 stelle)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

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

Guida contributor