XLPagerTabStrip
XLPagerTabStrip copied to clipboard
How to change line color under title?
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 }
Same here. Having that trouble. Did you find out the solution?
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
It doesn't work. The selected bar color still being black. Could you help me with this?
What does your ButtonBarPagerTabStripViewController (or other) class file look like mate, can you make a gist and link it to me?
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, 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()
}`
How can I change the new cell color