XLPagerTabStrip icon indicating copy to clipboard operation
XLPagerTabStrip copied to clipboard

How to change line color under title?

Open Hamza123Imran opened this issue 6 years ago • 7 comments

Hi, i'm using this lib in my project i have given titles and change the line color to yellow. But when i run the app it shows me black line under the title. How can i change that? This is my code, // change selected bar color settings.style.buttonBarBackgroundColor = #colorLiteral(red: 1, green: 0.8, blue: 0.05882352941, alpha: 1) settings.style.buttonBarItemBackgroundColor = .white settings.style.selectedBarBackgroundColor = #colorLiteral(red: 1, green: 0.8, blue: 0.05882352941, alpha: 1) settings.style.buttonBarItemFont = .boldSystemFont(ofSize: 16) settings.style.selectedBarHeight = 1 settings.style.buttonBarMinimumLineSpacing = 0 settings.style.buttonBarItemTitleColor = #colorLiteral(red: 1, green: 0.8, blue: 0.05882352941, alpha: 1) settings.style.buttonBarItemsShouldFillAvailiableWidth = true settings.style.buttonBarLeftContentInset = 0 settings.style.buttonBarRightContentInset = 0 changeCurrentIndexProgressive = { [weak self] (oldCell: ButtonBarViewCell?, newCell: ButtonBarViewCell?, progressPercentage: CGFloat, changeCurrentIndex: Bool, animated: Bool) -> Void in guard changeCurrentIndex == true else { return } oldCell?.label.textColor = #colorLiteral(red: 0.6666666865, green: 0.6666666865, blue: 0.6666666865, alpha: 1) newCell?.label.textColor = self?.purpleInspireColor }

Hamza123Imran avatar Aug 13 '18 11:08 Hamza123Imran

Same here. Having that trouble. Did you find out the solution?

luminkhant avatar Sep 05 '18 08:09 luminkhant

settings.style.selectedBarBackgroundColor = .yellow

or define a new color and set it.

let yellowColor = UIColor(displayP3Red: 10.0/255.0, green: 10.0/255.0, blue: 10.0/255.0, alpha: 1.0) settings.style.selectedBarBackgroundColor = yellowColor

ajurcevic avatar Sep 08 '18 07:09 ajurcevic

It doesn't work. The selected bar color still being black. Could you help me with this?

luminkhant avatar Sep 10 '18 04:09 luminkhant

What does your ButtonBarPagerTabStripViewController (or other) class file look like mate, can you make a gist and link it to me?

ajurcevic avatar Sep 17 '18 09:09 ajurcevic

Hi, thanks for your reply i have used this code but still same issue it is not catching the color which i'm providing, this is my code, // change selected bar color settings.style.buttonBarBackgroundColor = .white settings.style.buttonBarItemBackgroundColor = .white settings.style.selectedBarBackgroundColor = #colorLiteral(red: 0, green: 0.8531913161, blue: 0.471188426, alpha: 1) settings.style.buttonBarItemFont = .boldSystemFont(ofSize: 14) settings.style.selectedBarHeight = 2.0 settings.style.buttonBarMinimumLineSpacing = 0 settings.style.buttonBarItemTitleColor = #colorLiteral(red: 0, green: 0.8531913161, blue: 0.471188426, alpha: 1) settings.style.buttonBarItemsShouldFillAvailiableWidth = true settings.style.buttonBarLeftContentInset = 0 settings.style.buttonBarRightContentInset = 0 changeCurrentIndexProgressive = { [weak self] (oldCell: ButtonBarViewCell?, newCell: ButtonBarViewCell?, progressPercentage: CGFloat, changeCurrentIndex: Bool, animated: Bool) -> Void in guard changeCurrentIndex == true else { return } oldCell?.label.textColor = .black newCell?.label.textColor = self?.purpleInspireColor. Ca n u please check it?. @ajurcevic

Hamza123Imran avatar Oct 22 '18 12:10 Hamza123Imran

Hi, thanks for your reply i have used this code but still same issue it is not catching the color which i'm providing, this is my code, // change selected bar color settings.style.buttonBarBackgroundColor = .white settings.style.buttonBarItemBackgroundColor = .white settings.style.selectedBarBackgroundColor = #colorLiteral(red: 0, green: 0.8531913161, blue: 0.471188426, alpha: 1) settings.style.buttonBarItemFont = .boldSystemFont(ofSize: 14) settings.style.selectedBarHeight = 2.0 settings.style.buttonBarMinimumLineSpacing = 0 settings.style.buttonBarItemTitleColor = #colorLiteral(red: 0, green: 0.8531913161, blue: 0.471188426, alpha: 1) settings.style.buttonBarItemsShouldFillAvailiableWidth = true settings.style.buttonBarLeftContentInset = 0 settings.style.buttonBarRightContentInset = 0 changeCurrentIndexProgressive = { [weak self] (oldCell: ButtonBarViewCell?, newCell: ButtonBarViewCell?, progressPercentage: CGFloat, changeCurrentIndex: Bool, animated: Bool) -> Void in guard changeCurrentIndex == true else { return } oldCell?.label.textColor = .black newCell?.label.textColor = self?.purpleInspireColor. Ca n u please check it?. @ajurcevic

Hi there,

Please place the code before super.viewDidLoad(). It works for me.

This is my code:

` override func viewDidLoad() {

    settings.style.buttonBarBackgroundColor = .black
    settings.style.buttonBarItemBackgroundColor = .black
    settings.style.selectedBarBackgroundColor = .white
    settings.style.buttonBarItemFont = .boldSystemFont(ofSize: 14)
    settings.style.selectedBarHeight = 2.0
    settings.style.buttonBarMinimumLineSpacing = 0
    settings.style.buttonBarItemTitleColor = .white
    settings.style.buttonBarItemsShouldFillAvailiableWidth = true
    settings.style.buttonBarLeftContentInset = 0
    settings.style.buttonBarRightContentInset = 0
    
    changeCurrentIndexProgressive = {(oldCell: ButtonBarViewCell?, newCell: ButtonBarViewCell?, progressPercentage: CGFloat, changeCurrentIndex: Bool, animated: Bool) -> Void in
        guard changeCurrentIndex == true else { return }
        oldCell?.label.textColor = .white
        newCell?.label.textColor = .white
        
    }
    buttonBarView.backgroundColor   =   .black
    
    super.viewDidLoad()

}`

devianl2 avatar Nov 15 '18 11:11 devianl2

How can I change the new cell color

hechukwu avatar Dec 17 '20 08:12 hechukwu