xmartlabs/XLPagerTabStrip

Vertically Centralising text in BarButtonView

Open

#411 建立於 2017年7月4日

在 GitHub 查看
 (2 留言) (2 反應) (0 負責人)Swift (6,965 star) (1,319 fork)batch import
help wanted

描述

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

貢獻者指南